⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 agent.cpp

📁 robocup 3d, a 3d base team similar to UvA 2d
💻 CPP
字号:
/***********************************************************************************                            In the name of Almighty                            **                                                                               **            Agent.cpp : Robocup 3D Soccer Simulation Team Zigorat              **                     (This team was previously named Gcyrus)                   **                                                                               **  Date: 03/20/2007                                                             **  Author: Mahdi Hamdarsi                                                       **  Comments: This files contains class definition Agent which is the main       **            thinkin' module                                                    **                                                                               ***********************************************************************************//*! \file Agent.cpp<pre><b>File:</b>          Agent.cpp<b>Project:</b>       Robocup Soccer Simulation Team: Zigorat<b>Authors:</b>       Mahdi Hamdarsi<b>Created:</b>       03/20/2007<b>Last Revision:</b> $ID$<b>Contents:</b>      This files contains class definition Agent which is the main               thinkin' module<hr size=2><h2><b>Changes</b></h2><b>Date</b>             <b>Author</b>          <b>Comment</b>03/20/2007       Mahdi           Initial version created</pre>*/#include "Agent.h"/******************************************************************************//*********************************  AGENT CLASS  ******************************//******************************************************************************//*! This is the constructor the Agent and calls the constructor of the   superclass BasicAgent.   \param conn Connection to server to send/recieve messages with   \param wm WorldModel as the momery of the agent   \param act ActHanfler for synchronizing commands */Agent::Agent( TRoboCupConnection * conn, WorldModel * wm, ActHandler *act )    : BasicAgent(conn, wm, act){}/*! This is the destructor of agent and currently does nothing. */Agent::~Agent(){}/*! This is the main loop of the agent. This method calls the update methods    of the world model after it is indicated that new information has arrived.    After this, the main thinkin' loop of the agent is called, which sends     the best command according to his/her! simple mind :) to the server. */void Agent::mainLoop(){  char strServerMsg[2048], *strMsg;  while( connection->getMessage( strServerMsg, 2047 ) )  {    if( WM->getCurrentCycle() == 0 )      sendPlayerInformation();    else if( WM->getCurrentCycle() == 1 )      InitializePlayerPosition();    strMsg = strServerMsg;    WM->updateFromServerMsg(&strMsg);    makeDecision();    ACT->sendCommands();  }}/*! This method is the first complete simple agent and defines the actions    taken by the agent. It is based on highlevel actions which are goin' to    be coded. */void Agent::deMeer5(){  static bool start = true;  static int  iStep = 1;  static Time time = WM->getSimulatorTime();  if( WM->getSimulatorTime() - time < 2 )    return;  if( iStep == 1 )  {    if( turnTo( 90, start ) )    {      iStep++;      start = true;    }    else      return;   }    walk( start );}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -