![]() |
OOP A3 Board Games 35
a Board Game Project Made by Students at Cairo FCAI
|
Base template for any board used in board games. More...
#include <BoardGame_Classes.h>
Public Member Functions | |
| Board (int rows, int columns) | |
| Construct a board with given dimensions. | |
| virtual | ~Board () |
| Virtual destructor. Frees allocated board memory. | |
| virtual bool | update_board (Move< T > *move)=0 |
| Update the board with a new move. | |
| virtual bool | is_win (Player< T > *)=0 |
| Check if a player has won. | |
| virtual bool | is_lose (Player< T > *)=0 |
| Check if a player has lost. | |
| virtual bool | is_draw (Player< T > *)=0 |
| Check if the game ended in a draw. | |
| virtual bool | game_is_over (Player< T > *)=0 |
| Check if the game is over. | |
| vector< vector< T > > | get_board_matrix () const |
| Return a copy of the current board as a 2D vector. | |
| int | get_rows () const |
| Get number of rows. | |
| int | get_columns () const |
| Get number of columns. | |
Protected Attributes | |
| int | rows |
| Number of rows. | |
| int | columns |
| Number of columns. | |
| vector< vector< T > > | board |
| 2D vector for the board | |
| int | n_moves = 0 |
| Number of moves made. | |
Base template for any board used in board games.
| T | Type of the elements stored on the board (e.g., char, int, string). |
Provides core data (rows, columns, matrix) and virtual methods to be implemented by specific games like Tic-Tac-Toe, Connect4, etc.
|
inline |
Construct a board with given dimensions.
Virtual destructor. Frees allocated board memory.
Check if the game is over.
Implemented in DiamondTicTacToeBoard, FourBoard, FourInARowBoard, InfinityTicTacToeBoard, MemoryTicTacToeBoard, MisereTicTacToe_Board, Numerical_Board, NumericalTicTacToeBoard, ObstaclesTicTacToeBoard, Pyramic_XO_Board, SUS_Board, SUSBoard, TicTacToe4x4_Board, TicTacToe5x5_Board, UltimateTicTacToeBoard, word_Board, and XO_Board.
|
inline |
Return a copy of the current board as a 2D vector.
|
inline |
Get number of columns.
|
inline |
Get number of rows.
Check if the game ended in a draw.
Implemented in DiamondTicTacToeBoard, FourBoard, FourInARowBoard, InfinityTicTacToeBoard, MemoryTicTacToeBoard, MisereTicTacToe_Board, Numerical_Board, NumericalTicTacToeBoard, ObstaclesTicTacToeBoard, Pyramic_XO_Board, SUS_Board, SUSBoard, TicTacToe4x4_Board, TicTacToe5x5_Board, UltimateTicTacToeBoard, word_Board, and XO_Board.
Check if a player has lost.
Implemented in DiamondTicTacToeBoard, FourBoard, FourInARowBoard, InfinityTicTacToeBoard, MemoryTicTacToeBoard, MisereTicTacToe_Board, Numerical_Board, NumericalTicTacToeBoard, ObstaclesTicTacToeBoard, Pyramic_XO_Board, SUS_Board, SUSBoard, TicTacToe4x4_Board, TicTacToe5x5_Board, UltimateTicTacToeBoard, word_Board, and XO_Board.
Check if a player has won.
Implemented in DiamondTicTacToeBoard, FourBoard, FourInARowBoard, InfinityTicTacToeBoard, MemoryTicTacToeBoard, MisereTicTacToe_Board, Numerical_Board, NumericalTicTacToeBoard, ObstaclesTicTacToeBoard, Pyramic_XO_Board, SUS_Board, SUSBoard, TicTacToe4x4_Board, TicTacToe5x5_Board, UltimateTicTacToeBoard, word_Board, and XO_Board.
Update the board with a new move.
| move | The move object containing position and symbol. |
Implemented in DiamondTicTacToeBoard, FourBoard, FourInARowBoard, InfinityTicTacToeBoard, MemoryTicTacToeBoard, MisereTicTacToe_Board, Numerical_Board, NumericalTicTacToeBoard, ObstaclesTicTacToeBoard, Pyramic_XO_Board, SUS_Board, SUSBoard, TicTacToe4x4_Board, TicTacToe5x5_Board, UltimateTicTacToeBoard, word_Board, and XO_Board.
|
protected |
2D vector for the board
|
protected |
Number of columns.
|
protected |
Number of moves made.
|
protected |
Number of rows.