Trabalho Prático - PDS2
Carregando...
Procurando...
Nenhuma entrada encontrado
reversi.hpp
1#ifndef REVERSI_HPP
2#define REVERSI_HPP
3
4#include <vector>
5
6#include "game.hpp"
7#include "string_utils.hpp"
8#include "exceptions.hpp"
9
10struct Direction {
11 int dx;
12 int dy;
13
14 Direction(int x, int y);
15};
16
17class Reversi: public Game {
18 private:
19
20 // std::vector<std::pair<int, int>> toEat;
21
22 static const Direction _dirs[];
23
24 void readMove() override;
25
26 void validateMove(const int row, const int col);
27
28 void checkPosition(const int row, const int col);
29
30 void checkBoundaries(const int row, const int col);
31
32 void checkDirections(const int row, const int col);
33
34 bool checkDirection(const int row, const int col, char other, const Direction& dir);
35
36 public:
37
38 Reversi();
39
40 void makeMove() override;
41
42 char isGameFinished() override;
43};
44
45#endif
Definição game.hpp:9
Definição reversi.hpp:17
char isGameFinished() override
Checks if the game of Reversi is finished.
Definição reversi.cpp:234
void checkBoundaries(const int row, const int col)
Checks if the given row and column are within the boundaries of the board.
Definição reversi.cpp:72
void makeMove() override
Executes a move in the Reversi game.
Definição reversi.cpp:195
void validateMove(const int row, const int col)
Validates a move in the Reversi game.
Definição reversi.cpp:154
static const Direction _dirs[]
Array of possible directions for the Reversi game.
Definição reversi.hpp:42
void checkPosition(const int row, const int col)
Checks if the specified position on the board is occupied.
Definição reversi.cpp:60
bool checkDirection(const int row, const int col, char other, const Direction &dir)
Checks a specific direction from a given position on the board to find and mark opponent's pieces to ...
Definição reversi.cpp:90
Reversi()
Constructs a Reversi game with an 8x8 board and initializes the starting positions.
Definição reversi.cpp:6
void checkDirections(const int row, const int col)
Checks all possible directions from a given position on the board.
Definição reversi.cpp:131
void readMove() override
Reads a move from the user and validates it.
Definição reversi.cpp:165
Definição reversi.hpp:10