Public Member Functions

Rules< BoardType > Class Template Reference

Base implementation for game rules. More...

#include <Game/Rules/Rules.hpp>

List of all members.

Public Member Functions

virtual void init (BoardType &cb)=0
virtual bool check (const BoardType &cb, Move< Coords > &move) const =0
virtual bool checkVictory (const BoardType &cb, const int color) const =0
virtual bool checkDraw (const History< Move< Coords > > &history) const =0
virtual void move (const BoardType &cb, const Move< Coords > &move)=0

Detailed Description

template<typename BoardType>
class Rules< BoardType >

Base implementation for game rules.

The rules are a set of laws that the player has to follow. This defines the initial position of the game, if a move a legal and when one of the player wins (or draw). These rules are described using the functions init(), check() checkVictory() and checkDraw(). The final function move() is here to keep a track on how is going the game.


Member Function Documentation

template<typename BoardType>
virtual bool Rules< BoardType >::check ( const BoardType &  cb,
Move< Coords > &  move 
) const [pure virtual]

Check if the move is correct

Parameters:
cb the board where the move should be checked
move 
Returns:
true if the move is legit
template<typename BoardType>
virtual bool Rules< BoardType >::checkDraw ( const History< Move< Coords > > &  history  )  const [pure virtual]

Check if the game is in a draw condition

Parameters:
history the game history to check if redondant move are
Returns:
true if the game is in draw
template<typename BoardType>
virtual bool Rules< BoardType >::checkVictory ( const BoardType &  cb,
const int  color 
) const [pure virtual]

Check if the game is in a victory condition

Parameters:
cb the board of the game
color the color for who to check the victory
Returns:
true if color wins
template<typename BoardType>
virtual void Rules< BoardType >::init ( BoardType &  cb  )  [pure virtual]

Set the initial pieces on board

Parameters:
cb the board to set
template<typename BoardType>
virtual void Rules< BoardType >::move ( const BoardType &  cb,
const Move< Coords > &  move 
) [pure virtual]

Apply a move

Parameters:
cb the board of the game
move 
Returns:

The documentation for this class was generated from the following file:
 All Classes Functions Variables