#include <Reversi.h>
|
| bool | getMove () |
| | Gets a move from the player. More...
|
| |
| bool | isValidMove (int destinationX) const |
| | Determins if a destination square is valid. More...
|
| |
| bool | executeMove (Square &destinationSquare) const |
| | Call the flanks method to ensure the destination coordinate flanks an opponents piece. More...
|
| |
| int | isOver () |
| | Determines if the game has been won or not. More...
|
| |
| bool | checkNext (Square ¤t, int yOffset, int xOffset, bool flip) const |
| |
| bool | flanks (Square current, bool flip) const |
| |
| bool | isLegal (Coordinate current, int iOffset, int jOffset) const |
| | Checks if the next square is inside the bounds of the board. More...
|
| |
Reversi Game.
- Author
- Peter Morgan
| bool Reversi::checkNext |
( |
Square & |
current, |
|
|
int |
yOffset, |
|
|
int |
xOffset, |
|
|
bool |
flip |
|
) |
| const |
|
private |
Checks a line of pieces to see if it ends with a piece that belong to the current player if it does, it flips the line of pieces to the current players colour
Checks a line of pieces to see if it ends with a piece that belong to the Current player, if it does it removes the line of pieces and exchanges them with pieces owned by the current player.
| bool Reversi::executeMove |
( |
Square & |
destSquare | ) |
const |
|
private |
Call the flanks method to ensure the destination coordinate flanks an opponents piece.
Call the flanks method to ensure the destination coordinate flanks an opponents piece. If it does it adds the piece to the destination square.
| bool Reversi::flanks |
( |
Square |
current, |
|
|
bool |
flip |
|
) |
| const |
|
private |
Checks if a coordinate flanks an opponents piece. Calls check next to see if the piece is inline with an existing piece owned by the same player.
Checks if the current square flanks an opponents piece Boolean flip is passed in to tel the function if we want to flip the pieces or we're just testing if there is a place where a move could be made.
| bool Reversi::getMove |
( |
| ) |
|
|
privatevirtual |
Gets a move from the player.
Calls getPoint to get the destination square validates the move and passes the destination square onto executeMove().
Implements Game.
| bool Reversi::isLegal |
( |
Coordinate |
current, |
|
|
int |
iOffset, |
|
|
int |
jOffset |
|
) |
| const |
|
private |
Checks if the next square is inside the bounds of the board.
Determines if the game has been won or not.
Implements Game.
| bool Reversi::isValidMove |
( |
int |
destinationX | ) |
const |
|
private |
Determins if a destination square is valid.
The documentation for this class was generated from the following files: