|
CBG
0.1
Compendium of board games
|
#include <SnakesAndLadders.h>
Public Member Functions | |
| SnakesAndLadders () | |
| ~SnakesAndLadders () | |
| Deconstructor for snakes and ladders. More... | |
Public Member Functions inherited from Game | |
| Game (const int amountOfPlayers, const int columns, const int rows) | |
| virtual | ~Game () |
| virtual void | start () |
Private Member Functions | |
| void | drawScreen () const |
| Prints out the board, players, snakes and ladders. More... | |
| int | rollDice () const |
| Generate a random number between 1 and 6. More... | |
| bool | getMove () |
| bool | executeMove (Square *sourceSquare, Square *destinationSquare) const |
| Moves the piece on srcSquare to destSquare. More... | |
| Coordinate | squareToCoordinate (int position) const |
| Converts an square identifier to a coordinate. More... | |
| bool | printSnakeLadder (int x, int y) const |
| Prints a snake and ladder at coordinates x,y. More... | |
| int | isOver () |
| Check if square with identifier 100 is occupied. More... | |
Private Attributes | |
| Square ** | squareRefs |
| Pointers to the squares based on their identifiers. More... | |
| Player * | systemItems |
| Array that holds the snakes and ladder character representations. More... | |
| const int | amountOfSystemItems |
| Amount of system items. More... | |
Additional Inherited Members | |
Protected Member Functions inherited from Game | |
| void | clearScreen () const |
| Clears the terminal window. 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... | |
Snakes and Ladders Game.
| SnakesAndLadders::SnakesAndLadders | ( | ) |
| SnakesAndLadders::~SnakesAndLadders | ( | ) |
Deconstructor for snakes and ladders.
|
privatevirtual |
Prints out the board, players, snakes and ladders.
Implements Game.
|
private |
Moves the piece on srcSquare to destSquare.
|
privatevirtual |
Calls rollDice() and calculates the destination square Passes these too executeMove().
Implements Game.
|
privatevirtual |
Check if square with identifier 100 is occupied.
Implements Game.
|
private |
Prints a snake and ladder at coordinates x,y.
|
private |
Generate a random number between 1 and 6.
|
private |
Converts an square identifier to a coordinate.
|
private |
Amount of system items.
|
private |
Pointers to the squares based on their identifiers.
|
private |
Array that holds the snakes and ladder character representations.