Public Member Functions | |
virtual | ~COandXEngine () |
void | Reset () |
TTileState | TileStatus (TInt aIndex) const |
TBool | TryMakeMove (TInt aIndex, TBool aCrossTurn) |
TTileState | GameWonBy () const |
void | ExternalizeL (RWriteStream &aStream) const |
void | InternalizeL (RReadStream &aStream) |
void | Reset () |
TTileState | TileStatus (TInt aIndex) const |
TBool | TryMakeMove (TInt aIndex, TBool aCrossTurn) |
TTileState | GameWonBy () const |
void | ExternalizeL (RWriteStream &aStream) const |
void | InternalizeL (RReadStream &aStream) |
Static Public Member Functions | |
static COandXEngine * | NewL () |
static COandXEngine * | NewL () |
This engine class represents the board, a grid of tiles which can be modified by the controller.
Definition at line 24 of file oandxengine.h.
COandXEngine::~COandXEngine | ( | ) | [virtual] |
This destructor is only defined to ensure there is exactly one definition.
Definition at line 46 of file oandxengine.cpp.
COandXEngine * COandXEngine::NewL | ( | ) | [static] |
Factory function allocates new instance of COandXEngine.
Definition at line 23 of file oandxengine.cpp.
void COandXEngine::Reset | ( | ) |
Mark all tiles as blank. This is an engine-only operation; it does not affect any comms connections or the UI.
Definition at line 55 of file oandxengine.cpp.
TTileState COandXEngine::TileStatus | ( | TInt | aIndex | ) | const |
Return the indexed tile's state.
aIndex | Zero-based tile index. |
Definition at line 67 of file oandxengine.cpp.
TBool COandXEngine::TryMakeMove | ( | TInt | aIndex, | |
TBool | aCrossTurn | |||
) |
This function is called by the controller when the local or remote player wants to select a tile. If the tile is blank, it allows the move. Note this function does not know whose turn it should be - that is the controller's responsibility.
aIndex | Index of tile to update. | |
aCrossTurn | Whether it is cross' or nought's turn. |
Definition at line 79 of file oandxengine.cpp.
TTileState COandXEngine::GameWonBy | ( | ) | const |
Check if there is a full line of noughts or crosses. The line can be horizontal, vertical, or diagonal.
Definition at line 114 of file oandxengine.cpp.
void COandXEngine::ExternalizeL | ( | RWriteStream & | aStream | ) | const |
Externalize the board to the supplied stream.
aStream | Stream to which the board's state will be written. |
Definition at line 171 of file oandxengine.cpp.
void COandXEngine::InternalizeL | ( | RReadStream & | aStream | ) |
Internalize the board from the supplied stream.
aStream | Stream which contains externalized board state. |
Definition at line 186 of file oandxengine.cpp.