CBG  0.1
Compendium of board games
Checkers Class Reference

#include <Checkers.h>

Inheritance diagram for Checkers:
GameWithXYSelector Game

Public Member Functions

 Checkers ()
 
- Public Member Functions inherited from GameWithXYSelector
 GameWithXYSelector (const int amountOfPlayers, const int columns, const int rows)
 
- Public Member Functions inherited from Game
 Game (const int amountOfPlayers, const int columns, const int rows)
 
virtual ~Game ()
 
virtual void start ()
 

Private Member Functions

bool getMove ()
 
int validMove (Coordinate srcCoordinate, Coordinate destCoordinate) const
 Validates moves. More...
 
bool executeMove (Square &srcSquare, Square &destSquare)
 Moves the piece on source square to destination square. More...
 
bool executeMove (Square &srcSquare, Square &destSquare, Square &toJump)
 
int isOver ()
 Checks if either of the players no longer have pieces. More...
 

Additional Inherited Members

- Protected Member Functions inherited from GameWithXYSelector
void drawScreen () const
 Prints out the board and the players pieces. More...
 
int getPoint (string message, int range) const
 Prompts with message to get a point between 0 and range. More...
 
int getOpposition () const
 Returns the opposition. More...
 
- Protected Attributes inherited from Game
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

Checkers Game.

Author
Ian Duffy

Constructor & Destructor Documentation

Checkers::Checkers ( )

Member Function Documentation

bool Checkers::executeMove ( Square srcSquare,
Square destSquare 
)
private

Moves the piece on source square to destination square.

bool Checkers::executeMove ( Square srcSquare,
Square destSquare,
Square toJump 
)
private

Moves the piece on source square to destination square and deletes the piece on the to jump square.

bool Checkers::getMove ( )
privatevirtual

Calls getPoint twice to get a source square and destination square Validates the move and passes the source square and destination square onto executeMove().

Implements Game.

int Checkers::isOver ( )
privatevirtual

Checks if either of the players no longer have pieces.

Checks if either of the players no longer have pieces or a player cannot move.

Implements Game.

int Checkers::validMove ( Coordinate  srcCoordinate,
Coordinate  destCoordinate 
) const
private

Validates moves.


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