CrossZeroPlayer Class Reference

#include <CrossZeroPlayer.h>

Inheritance diagram for CrossZeroPlayer:

Inheritance graph
[legend]

List of all members.

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


Detailed Description

The CrossZeroPlayer-class is abstract class that models game player in abstract level. All classes that model (CrossZeroGame) players should be inherited from this class - no direct instances from this class should be done.

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.


Constructor & Destructor Documentation

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.

Parameters:
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.


Member Function Documentation

void CrossZeroPlayer::setPlayerToken ( const std::string &  strToken  )  [inline]

Sets player token. This token is drewn in to game field.

Parameters:
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().

Here is the caller graph for this function:

std::string CrossZeroPlayer::getPlayerToken (  )  const [inline]

Returns player token to caller.

Returns:
player token (which is one letter)

Definition at line 54 of file CrossZeroPlayer.h.

References _strToken.

Referenced by CrossZeroHumanPlayer::getRespond(), and CrossZeroEngine::start().

Here is the caller graph for this function:

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.

Parameters:
pField is pointer to current gamefield-object.
Returns:
point which contains 2D-coordinate of player's next move on gamefield.

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".

Returns:
player type

Definition at line 67 of file CrossZeroPlayer.h.

References _strPlayerType.


Member Data Documentation

std::string CrossZeroPlayer::_strToken [private]

Definition at line 70 of file CrossZeroPlayer.h.

Referenced by getPlayerToken(), and setPlayerToken().

std::string CrossZeroPlayer::_strPlayerType [private]

Definition at line 71 of file CrossZeroPlayer.h.

Referenced by getPlayerType().


The documentation for this class was generated from the following file:

Generated on Mon Feb 25 23:18:58 2008 for CrossZero by  doxygen 1.5.5