#include <Player.h>
Inheritance diagram for Player:
Public Methods | |
Player (ActHandler *a, WorldModel *wm, ServerSettings *ss, PlayerSettings *cs, Formations *fs, char *strTeamName, double dVersion, int iReconnect=-1) | |
void | mainLoop () |
void | deMeer5 () |
void | deMeer5_goalie () |
void | handleStdin () |
void | showStringCommands (ostream &out) |
bool | executeStringCommand (char *str) |
void | test_only_update () |
Private Methods | |
void | goalieMainLoop () |
void | defenderMainLoop () |
void | midfielderMainLoop () |
void | attackerMainLoop () |
bool | shallISaySomething () |
bool | amIAgentToSaySomething () |
SoccerCommand | sayBallStatus () |
Private Attributes | |
Formations * | formations |
bool | bContLoop |
Time | m_timeLastSay |
Definition at line 59 of file Player.h.
|
This is the constructor the Player class and calls the constructor of the superclass BasicPlayer.
Definition at line 62 of file Player.C. References BasicPlayer::ACT, bContLoop, formations, Formations::getPlayerInFormation(), Formations::getPlayerType(), m_timeLastSay, MAX_MSG, BasicPlayer::PS, PT_GOALKEEPER, ActHandler::sendMessage(), WorldModel::setTeamName(), BasicPlayer::SS, and BasicPlayer::WM. |
|
This method returns a boolean indicating whether I should communicate my world model to the other agents.
Definition at line 445 of file Player.C. References WorldModel::getCurrentTime(), WorldModel::getRelativeDistance(), WorldModel::getTimeChangeInformation(), ServerSettings::getVisibleDistance(), OBJECT_BALL, BasicPlayer::SS, and BasicPlayer::WM. Referenced by shallISaySomething(). |
|
This is the main decision loop for an agent. Definition at line 169 of file Player.C. References deMeer5(). Referenced by mainLoop(). |
|
This is the main decision loop for a defender. Definition at line 157 of file Player.C. References deMeer5(). Referenced by mainLoop(). |
|
|
|
|
This is the main decision loop for the goalkeeper. Definition at line 151 of file Player.C. References deMeer5_goalie(). Referenced by mainLoop(). |
|
This method listens for input from the keyboard and when it receives this input it converts this input to the associated action. See showStringCommands for the possible options. This method is used together with the SenseHandler class that sends an alarm to indicate that a new command can be sent. This conflicts with the method in this method that listens for the user input (fgets) on Linux systems (on Solaris this isn't a problem). The only known method is to use the flag SA_RESTART with this alarm function, but that does not seem to work under Linux. If each time the alarm is sent, this gets function unblocks, it will cause major performance problems. This function should not be called when a whole match is played! Definition at line 525 of file Player.C. References executeStringCommand(), and MAX_MSG. Referenced by stdin_callback(). |
|
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 correct main loop of the player type is called, which puts the best soccer command in the queue of the ActHandler. Definition at line 96 of file Player.C. References BasicPlayer::ACT, attackerMainLoop(), bContLoop, defenderMainLoop(), formations, WorldModel::getCurrentCycle(), WorldModel::getCurrentTime(), WorldModel::getPlayerNumber(), Formations::getPlayerType(), WorldModel::getTimeLastSeeMessage(), goalieMainLoop(), WorldModel::iNrHoles, WorldModel::iNrOpponentsSeen, WorldModel::iNrTeammatesSeen, m_timeLastSay, midfielderMainLoop(), PT_ATTACKER, PT_ATTACKER_WING, PT_DEFENDER_SWEEPER, PT_DEFENDER_WING, PT_GOALKEEPER, PT_ILLEGAL, PT_MIDFIELDER_CENTER, PT_MIDFIELDER_WING, sayBallStatus(), ActHandler::sendCommandDirect(), ActHandler::sendCommands(), shallISaySomething(), WorldModel::updateAll(), WorldModel::waitForNewInformation(), and BasicPlayer::WM. Referenced by main(). |
|
This is the main decision loop for a midfielder. Definition at line 163 of file Player.C. References deMeer5(). Referenced by mainLoop(). |
|
This method is used to communicate the status of the ball, that is its position and velocity. Definition at line 457 of file Player.C. References BasicPlayer::communicate(), WorldModel::getGlobalPosition(), WorldModel::getGlobalVelocity(), VecPosition::getX(), VecPosition::getY(), MAX_SAY_MSG, min(), OBJECT_BALL, and BasicPlayer::WM. Referenced by mainLoop(). |
|
This method determines whether a player should say something.
Definition at line 431 of file Player.C. References amIAgentToSaySomething(), WorldModel::getCurrentCycle(), WorldModel::getCurrentTime(), ServerSettings::getHearDecay(), m_timeLastSay, BasicPlayer::SS, and BasicPlayer::WM. Referenced by mainLoop(). |
|
This method prints the possible commands that can be entered by the user. The whole name can be entered to perform the corresponding command, but normally only the first character is sufficient. This is indicated by putting brackets around the part of the command that is not needed.
Definition at line 542 of file Player.C. Referenced by executeStringCommand(). |
|
This method does nothing except updating the worldmodel after each arrival of a see or sense_body message. Using this test program it is possible to control the commands of the agent using the standard input and see the resulting behavior of the agent. Definition at line 484 of file Player.C. References bContLoop, WorldModel::updateAll(), WorldModel::waitForNewInformation(), and BasicPlayer::WM. Referenced by main(). |
|
is server is alive Definition at line 62 of file Player.h. Referenced by executeStringCommand(), mainLoop(), Player(), and test_only_update(). |
|
all formation information Definition at line 61 of file Player.h. Referenced by deMeer5(), deMeer5_goalie(), mainLoop(), and Player(). |
|
last time communicated Definition at line 64 of file Player.h. Referenced by mainLoop(), Player(), and shallISaySomething(). |