A game is just observers / controlers. More...
#include <Game/Game.hpp>
Public Member Functions | |
~Game () | |
const GameBoard * | getBoard () |
const GameRules * | getRules () |
bool | addControler (Controler< GameBoard > *pControler) |
bool | addStatusListener (Listener< Move< Coords > > *pListener) |
bool | checkMove () |
bool | play () |
int | getCurrentColorTurn () const |
int | getVictoriousColor () const |
bool | isVictory () const |
bool | isDraw () const |
bool | loadHistory (const std::string &fileName) |
bool | saveHistory (const std::string &fileName) |
A game is just observers / controlers.
Controlers are seen like players. They propose moves and the rules checks the correctness of these. If it is the board will apply the move. You can have observers (generally UI) to look at the game. These just knows the move accepted. The game will just play by rotating players (controlers to who we are asking for moves) and accepting the moves. The game will stop when a victory or a draw is reached
The controlers are destructed
bool Game< GameBoard, GameRules >::addControler | ( | Controler< GameBoard > * | pControler | ) | [inline] |
Adds a controler to give moves (aka: player)
pControler |
bool Game< GameBoard, GameRules >::addStatusListener | ( | Listener< Move< Coords > > * | pListener | ) | [inline] |
Adds a listener for moves (aka: UI)
pListener |
const GameBoard* Game< GameBoard, GameRules >::getBoard | ( | ) | [inline] |
Gets the board
int Game< GameBoard, GameRules >::getCurrentColorTurn | ( | ) | const [inline] |
Return the color to which player to play
const GameRules* Game< GameBoard, GameRules >::getRules | ( | ) | [inline] |
Gets the rules
int Game< GameBoard, GameRules >::getVictoriousColor | ( | ) | const [inline, virtual] |
bool Game< GameBoard, GameRules >::isDraw | ( | ) | const [inline, virtual] |
bool Game< GameBoard, GameRules >::isVictory | ( | ) | const [inline, virtual] |
bool Game< GameBoard, GameRules >::loadHistory | ( | const std::string & | fileName | ) | [inline, virtual] |
Loads an history from a file named fileName
fileName |
Implements AbstractGame.
bool Game< GameBoard, GameRules >::play | ( | ) | [inline, virtual] |
Plays the game until the rules
declare that there is one player victorious or a draw is trigerred
Implements AbstractGame.
bool Game< GameBoard, GameRules >::saveHistory | ( | const std::string & | fileName | ) | [inline, virtual] |
Saves the game history in a file fileName
fileName |
Implements AbstractGame.