COandXEngine Class Reference

List of all members.

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 COandXEngineNewL ()
static COandXEngineNewL ()

Detailed Description

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.


Constructor & Destructor Documentation

COandXEngine::~COandXEngine (  )  [virtual]

This destructor is only defined to ensure there is exactly one definition.

Definition at line 46 of file oandxengine.cpp.


Member Function Documentation

COandXEngine * COandXEngine::NewL (  )  [static]

Factory function allocates new instance of COandXEngine.

Returns:
New game engine, which is owned by the caller. On return every tile is marked as blank, which is useful for rendering, although a game has not been started yet.

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.

Parameters:
aIndex Zero-based tile index.
Returns:
Tile state, i.e. ETileBlank, ETileNought, or ETileCross.

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.

Parameters:
aIndex Index of tile to update.
aCrossTurn Whether it is cross' or nought's turn.
Returns:
Whether the board was updated.

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.

Returns:
ETileNought if there is a line of noughts; ETileCross if there is a line of crosses; Zero if there is no complete line.

Definition at line 114 of file oandxengine.cpp.

void COandXEngine::ExternalizeL ( RWriteStream &  aStream  )  const

Externalize the board to the supplied stream.

Parameters:
aStream Stream to which the board's state will be written.
See also:
InternalizeL

Definition at line 171 of file oandxengine.cpp.

void COandXEngine::InternalizeL ( RReadStream &  aStream  ) 

Internalize the board from the supplied stream.

Parameters:
aStream Stream which contains externalized board state.
See also:
ExternalizeL

Definition at line 186 of file oandxengine.cpp.


Generated by  doxygen 1.6.2