#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 | handleStdin () |
void | showStringCommands (ostream &out) |
bool | executeStringCommand (char *str) |
SoccerCommand | deMeer5 () |
SoccerCommand | deMeer5_goalie () |
Private Methods | |
SoccerCommand | goalieMainLoop () |
SoccerCommand | defenderMainLoop () |
SoccerCommand | midfielderMainLoop () |
SoccerCommand | attackerMainLoop () |
void | performPenalty () |
VecPosition | getDeadBallPosition () |
bool | shallISaySomething (SoccerCommand soc) |
bool | amIAgentToSaySomething (SoccerCommand soc) |
void | sayOppAttackerStatus (char *str) |
void | sayBallStatus (char *str) |
void | makeBallInfo (VecPosition posBall, VecPosition velBall, int iDiff, char *str) |
Private Attributes | |
Formations * | formations |
bool | bContLoop |
Time | m_timeLastSay |
ObjectT | m_objMarkOpp |
ObjectT | m_objPassOption |
int | m_iPenaltyNr |
ActionT | m_actionPrev |
Definition at line 64 of file Player.h.
|
This is the constructor the Player class and calls the constructor of the superclass BasicPlayer.
Definition at line 66 of file Player.cpp. References BasicPlayer::ACT, ACT_ILLEGAL, bContLoop, formations, Formations::getPlayerInFormation(), Formations::getPlayerType(), m_actionPrev, m_iPenaltyNr, m_objMarkOpp, m_timeLastSay, MAX_MSG, OBJECT_ILLEGAL, 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 494 of file Player.cpp. References WorldModel::getAgentObjectType(), WorldModel::getBallPos(), WorldModel::getClosestInSetTo(), WorldModel::getConfidence(), WorldModel::getCurrentCycle(), WorldModel::getCurrentTime(), VecPosition::getDistanceTo(), ServerSettings::getMaximalKickDist(), WorldModel::getPlayerNumber(), WorldModel::getRelativeDistance(), WorldModel::getTimeChangeInformation(), WorldModel::getTimeLastSeen(), ServerSettings::getVisibleDistance(), VecPosition::getX(), OBJECT_BALL, OBJECT_SET_TEAMMATES, ObjectT, PENALTY_X, WorldModel::predictAgentPosAfterCommand(), WorldModel::predictBallInfoAfterCommand(), BasicPlayer::SS, and BasicPlayer::WM. Referenced by shallISaySomething(). |
|
This is the main decision loop for an agent. Definition at line 239 of file Player.cpp. References deMeer5(). Referenced by mainLoop(). |
|
This is the main decision loop for a defender. Definition at line 227 of file Player.cpp. References deMeer5(). Referenced by mainLoop(). |
|
|
|
|
This method returns the position to move in case of a dead ball situation. A dead ball situation occurs when the team can have a free kick, kick in, etc. The agent will move to the position behind the ball and when he is there will move to the ball again. Definition at line 248 of file Player.cpp. References AngDeg, WorldModel::getAgentGlobalPosition(), WorldModel::getAgentObjectType(), WorldModel::getBallPos(), WorldModel::getClosestInSetTo(), WorldModel::getGlobalPosition(), VecPosition::getY(), WorldModel::isBackPassThem(), WorldModel::isCornerKickUs(), WorldModel::isFreeKickFaultThem(), WorldModel::isFreeKickUs(), WorldModel::isGoalKickUs(), WorldModel::isKickInUs(), WorldModel::isOffsideThem(), VecPosition::normalizeAngle(), OBJECT_SET_PLAYERS, ObjectT, POLAR, sign(), UnknownDoubleValue, and BasicPlayer::WM. |
|
This is the main decision loop for the goalkeeper. Definition at line 221 of file Player.cpp. 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 293 of file Player.cpp. 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 108 of file Player.cpp. References BasicPlayer::ACT, attackerMainLoop(), bContLoop, defenderMainLoop(), formations, WorldModel::getBallPos(), WorldModel::getCurrentCycle(), WorldModel::getCurrentTime(), Timing::getElapsedTime(), ServerSettings::getHalfTime(), WorldModel::getPlayerNumber(), Formations::getPlayerType(), WorldModel::getPlayMode(), WorldModel::getRecvThink(), ServerSettings::getSimulatorStep(), ServerSettings::getSynchMode(), WorldModel::getTimeLastSeeMessage(), VecPosition::getX(), goalieMainLoop(), WorldModel::iNrHoles, WorldModel::iNrOpponentsSeen, WorldModel::iNrTeammatesSeen, Logger::isInLogLevel(), WorldModel::isPenaltyThem(), WorldModel::isPenaltyUs(), WorldModel::logCoordInfo(), WorldModel::logDrawBallInfo(), WorldModel::logDrawInfo(), m_timeLastSay, MAX_MSG, MAX_SAY_MSG, midfielderMainLoop(), OBJECT_BALL, PENALTY_X, performPenalty(), PM_FROZEN, WorldModel::processRecvThink(), PT_ATTACKER, PT_ATTACKER_WING, PT_DEFENDER_CENTRAL, PT_DEFENDER_SWEEPER, PT_DEFENDER_WING, PT_GOALKEEPER, PT_ILLEGAL, PT_MIDFIELDER_CENTER, PT_MIDFIELDER_WING, ActHandler::putCommandInQueue(), Timing::restartTime(), sayBallStatus(), sayOppAttackerStatus(), ActHandler::sendCommands(), ActHandler::sendMessage(), ActHandler::sendMessageDirect(), WorldModel::setCommunicationString(), Logger::setHeader(), shallISaySomething(), BasicPlayer::SS, BasicPlayer::turnBodyToObject(), WorldModel::updateAll(), WorldModel::waitForNewInformation(), and BasicPlayer::WM. Referenced by main(). |
|
This method is used to create the communicate message for the status of the ball, that is its position and velocity is encoded.
Definition at line 631 of file Player.cpp. References WorldModel::getCurrentCycle(), WorldModel::getOffsideX(), WorldModel::getPlayerNumber(), VecPosition::getX(), VecPosition::getY(), max(), MAX_SAY_MSG, min(), and BasicPlayer::WM. Referenced by sayBallStatus(). |
|
This is the main decision loop for a midfielder. Definition at line 233 of file Player.cpp. References deMeer5(). Referenced by mainLoop(). |
|
This method is called when a penalty kick has to be taken (for both the goalkeeper as the player who has to take the penalty. Definition at line 671 of file Player.cpp. References BasicPlayer::ACT, AngDeg, BasicPlayer::catchBall(), CMD_CHANGEVIEW, CMD_DASH, CMD_ILLEGAL, SoccerCommand::commandType, SoccerCommand::dPower, formations, WorldModel::getAgentGlobalBodyAngle(), WorldModel::getAgentGlobalPosition(), WorldModel::getAgentStamina(), WorldModel::getAgentViewAngle(), VecPosition::getDistanceTo(), ServerSettings::getPenAllowMultKicks(), ServerSettings::getPenDistX(), WorldModel::getPlayerNumber(), Formations::getPlayerType(), WorldModel::getPlayMode(), ServerSettings::getRecoverDecThr(), WorldModel::getSide(), WorldModel::getSidePenalty(), Stamina::getStamina(), ServerSettings::getStaminaMax(), VecPosition::getX(), BasicPlayer::intercept(), WorldModel::isBallCatchable(), WorldModel::isBallKickable(), SoccerCommand::isIllegal(), WorldModel::isPenaltyThem(), WorldModel::isPenaltyUs(), BasicPlayer::kickTo(), m_iPenaltyNr, BasicPlayer::moveToPos(), VecPosition::normalizeAngle(), OBJECT_BALL, PITCH_LENGTH, PlayModeT, PM_ILLEGAL, PM_PENALTY_READY_LEFT, PM_PENALTY_READY_RIGHT, PM_PENALTY_SETUP_LEFT, PM_PENALTY_SETUP_RIGHT, PM_PENALTY_TAKEN_LEFT, PM_PENALTY_TAKEN_RIGHT, POLAR, PT_GOALKEEPER, ActHandler::putCommandInQueue(), VecPosition::setVecPosition(), SIDE_LEFT, SIDE_RIGHT, BasicPlayer::SS, BasicPlayer::turnBodyToPoint(), BasicPlayer::turnNeckToObject(), VA_NARROW, VQ_HIGH, and BasicPlayer::WM. Referenced by mainLoop(). |
|
This method creates a string to communicate the ball status. When the player just kicks the ball, it is the new velocity of the ball, otherwise it is the current velocity.
Definition at line 595 of file Player.cpp. References BasicPlayer::ACT, CMD_KICK, SoccerCommand::commandType, VecPosition::getDistanceTo(), WorldModel::getGlobalPosition(), WorldModel::getGlobalVelocity(), ServerSettings::getMaximalKickDist(), ActHandler::getPrimaryCommand(), WorldModel::getRelativeDistance(), VecPosition::getX(), VecPosition::getY(), makeBallInfo(), OBJECT_BALL, WorldModel::predictAgentPos(), WorldModel::predictBallInfoAfterCommand(), VecPosition::setVecPosition(), BasicPlayer::SS, and BasicPlayer::WM. Referenced by mainLoop(). |
|
This method encodes the opponent attacker status in a visual message.
Definition at line 541 of file Player.cpp. References WorldModel::getClosestInSetTo(), WorldModel::getCurrentCycle(), WorldModel::getGlobalPosition(), SoccerTypes::getIndex(), WorldModel::getOffsideX(), VecPosition::getX(), VecPosition::getY(), max(), MAX_SAY_MSG, OBJECT_ILLEGAL, OBJECT_SET_OPPONENTS, ObjectT, PITCH_LENGTH, and BasicPlayer::WM. Referenced by mainLoop(). |
|
This method determines whether a player should say something.
Definition at line 480 of file Player.cpp. 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 314 of file Player.cpp. Referenced by executeStringCommand(). |
|
is server is alive Definition at line 67 of file Player.h. Referenced by executeStringCommand(), mainLoop(), and Player(). |
|
all formation information Definition at line 66 of file Player.h. Referenced by deMeer5(), deMeer5_goalie(), mainLoop(), performPenalty(), and Player(). |
|
previous action of this agent Definition at line 75 of file Player.h. Referenced by Player(). |
|
number of current penalty Definition at line 73 of file Player.h. Referenced by performPenalty(), and Player(). |
|
last marked opponent Definition at line 70 of file Player.h. Referenced by Player(). |
|
passing option in kick |
|
last time communicated Definition at line 69 of file Player.h. Referenced by mainLoop(), Player(), and shallISaySomething(). |