#include <CrossZeroPlayer.h>
Public Member Functions | |
CrossZeroPlayer () | |
CrossZeroPlayer (const std::string &strToken, const std::string &strType) | |
virtual | ~CrossZeroPlayer () |
void | setPlayerToken (const std::string &strToken) |
std::string | getPlayerToken () const |
virtual CrossZeroPoint< int > | getRespond (const CrossZeroGameField *pField=0)=0 |
std::string | getPlayerType () const |
Private Attributes | |
std::string | _strToken |
std::string | _strPlayerType |
All classes which are inherited from CrossZeroPlayer must overload getRespond() a method. In that method player actions on gamefield are generated (AI) or collected from input (Human).
Definition at line 25 of file CrossZeroPlayer.h.
CrossZeroPlayer::CrossZeroPlayer | ( | ) | [inline] |
Class default constructor sets player on default state which defines that player is human and its token is "0".
Definition at line 31 of file CrossZeroPlayer.h.
CrossZeroPlayer::CrossZeroPlayer | ( | const std::string & | strToken, | |
const std::string & | strType | |||
) | [inline] |
Class overloaded constructor.
strToken | is a string which contains player token (letter) | |
strType | is a string which contains player type, example "Human". |
Definition at line 38 of file CrossZeroPlayer.h.
virtual CrossZeroPlayer::~CrossZeroPlayer | ( | ) | [inline, virtual] |
Class default destructor, does not do anything..
Definition at line 42 of file CrossZeroPlayer.h.
void CrossZeroPlayer::setPlayerToken | ( | const std::string & | strToken | ) | [inline] |
Sets player token. This token is drewn in to game field.
strToken | is one letter, normally it is X or 0, but you can choose any letter you want except scandinavian letters. |
Definition at line 49 of file CrossZeroPlayer.h.
References _strToken.
Referenced by CrossZeroEngine::createPlayers().
std::string CrossZeroPlayer::getPlayerToken | ( | ) | const [inline] |
Returns player token to caller.
Definition at line 54 of file CrossZeroPlayer.h.
References _strToken.
Referenced by CrossZeroHumanPlayer::getRespond(), and CrossZeroEngine::start().
virtual CrossZeroPoint<int> CrossZeroPlayer::getRespond | ( | const CrossZeroGameField * | pField = 0 |
) | [pure virtual] |
Get player's next move on current gamefield. Note! This is abstract method which must be defined and overloaded in all classes which are inherited from this class.
pField | is pointer to current gamefield-object. |
Implemented in CrossZeroAiPlayer, and CrossZeroHumanPlayer.
std::string CrossZeroPlayer::getPlayerType | ( | ) | const [inline] |
Get player's type, for example if player is Human then this method will return string which contains word "Human".
Definition at line 67 of file CrossZeroPlayer.h.
References _strPlayerType.
std::string CrossZeroPlayer::_strToken [private] |
Definition at line 70 of file CrossZeroPlayer.h.
Referenced by getPlayerToken(), and setPlayerToken().
std::string CrossZeroPlayer::_strPlayerType [private] |