|
Trabalho Prático - PDS2
|


Membros Públicos | |
| TTT () | |
| Constructs a TTT (Tic-Tac-Toe) game object. | |
| void | readMove () override |
| Reads a move from the user and validates it. | |
| void | makeMove () override |
| Makes a move in the Tic-Tac-Toe game. | |
| char | isGameFinished () override |
| Checks the current state of the game to determine if it has finished. | |
Membros Públicos herdados de Game | |
| Game (int rows, int cols) | |
| Constructs a new Game object with the specified number of rows and columns. | |
| void | changePlayer () |
| virtual void | printBoard () |
| Prints the current state of the game board to the standard output. | |
Membros privados | |
| void | validateMove (int row, int col) |
| Validates a move in the Tic-Tac-Toe game. | |
| int | checkLine (bool isRow) |
| Checks if there is a winning line (row or column) in the Tic-Tac-Toe board. | |
| int | checkRows () |
| Checks the rows in the Tic-Tac-Toe game for a win condition. | |
| int | checkColumns () |
| Checks the columns in the game. | |
| int | checkDiagonals () |
| Checks the diagonals of the Tic-Tac-Toe board to determine if there is a winner. | |
Outros membros herdados | |
Atributos Protegidos herdados de Game | |
| Board | board |
| std::pair< int, int > | move |
| char | current_player |
|
private |
Checks the columns in the game.


|
private |
Checks the diagonals of the Tic-Tac-Toe board to determine if there is a winner.
This function checks both the main diagonal (from top-left to bottom-right) and the anti-diagonal (from top-right to bottom-left) of the board. If all three elements in either diagonal are the same, it returns the value of that element (which represents the winner). If neither diagonal has a winner, it returns a space character (' ').


|
private |
Checks if there is a winning line (row or column) in the Tic-Tac-Toe board.
This function iterates through each row or column of the board (depending on the isRow parameter) and checks if all elements in the row or column are the same and not empty.
| isRow | A boolean indicating whether to check rows (true) or columns (false). |


|
private |
Checks the rows in the Tic-Tac-Toe game for a win condition.


|
overridevirtual |
Checks the current state of the game to determine if it has finished.
Implementa Game.

|
overridevirtual |
Makes a move in the Tic-Tac-Toe game.
This function reads the player's move and sets the specified symbol at the corresponding position on the game board.
Implementa Game.

|
overridevirtual |
Reads a move from the user and validates it.
| InvalidInputException | if the move is invalid. |
Implementa Game.


|
private |
Validates a move in the Tic-Tac-Toe game.
This function checks if the move specified by the row and column is valid. A move is considered valid if the specified position on the board is empty and within the bounds of the board.
| row | The row index of the move. |
| col | The column index of the move. |
| InvalidInputException | if the position is already occupied or if the position is out of the board's bounds. |

