CBG  0.1
Compendium of board games
Game Class Referenceabstract

#include <Game.h>

Inheritance diagram for Game:
ConnectFour GameWithXYSelector SnakesAndLadders Checkers Reversi

Public Member Functions

 Game (const int amountOfPlayers, const int columns, const int rows)
 
virtual ~Game ()
 
virtual void start ()
 

Protected Member Functions

void clearScreen () const
 Clears the terminal window. More...
 
virtual bool getMove ()=0
 Gets input from the player detailing which move they wish to make. More...
 
virtual void drawScreen () const =0
 Draws out the board as required. More...
 
virtual int isOver ()=0
 Defines whether or not the game is over. More...
 

Protected Attributes

int currentPlayer
 Holds the position in the players array of the current player. More...
 
Player ** players
 Holds all of the games players. More...
 
Square ** grid
 Holds all of the squares that makes up the games grid. More...
 
const int amountOfPlayers
 Holds the length of the players array. More...
 
const int columns
 Holds the amount of columns within the grid. More...
 
const int rows
 Holds the amount of rows within the grid. More...
 

Detailed Description

Base foundation for all of the games.

Author
Ian Duffy
Darren Brogan

Constructor & Destructor Documentation

Game::Game ( const int  amountOfPlayers,
const int  columns,
const int  rows 
)
Game::~Game ( )
virtual

Member Function Documentation

void Game::clearScreen ( ) const
protected

Clears the terminal window.

virtual void Game::drawScreen ( ) const
protectedpure virtual

Draws out the board as required.

Implemented in ConnectFour, SnakesAndLadders, and GameWithXYSelector.

virtual bool Game::getMove ( )
protectedpure virtual

Gets input from the player detailing which move they wish to make.

Implemented in ConnectFour, SnakesAndLadders, Checkers, and Reversi.

virtual int Game::isOver ( )
protectedpure virtual

Defines whether or not the game is over.

Implemented in SnakesAndLadders, ConnectFour, Checkers, and Reversi.

void Game::start ( )
virtual

Controls the flow of the game, Continues to call getMove() until isOver() returns something other than 0.

Member Data Documentation

const int Game::amountOfPlayers
protected

Holds the length of the players array.

const int Game::columns
protected

Holds the amount of columns within the grid.

int Game::currentPlayer
protected

Holds the position in the players array of the current player.

Square** Game::grid
protected

Holds all of the squares that makes up the games grid.

Player** Game::players
protected

Holds all of the games players.

const int Game::rows
protected

Holds the amount of rows within the grid.


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