-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTTTCommonTypes.h
39 lines (33 loc) · 1008 Bytes
/
TTTCommonTypes.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#ifndef TTTCOMMONTYPES_H
#define TTTCOMMONTYPES_H
#include <cstddef>
class QPushButton;
namespace defaults
{
constexpr short INVALID_CELL = -1;
constexpr size_t DEFAULT_BOARD_SIZE = 3;
constexpr unsigned short DEFAULT_MINIMAX_DEPTH = 3;
constexpr unsigned short GUI_CELL_ROW_SPAN = 1;
constexpr unsigned short GUI_CELL_COLUMN_SPAN = 1;
constexpr char X_COLOR[] = "#455A64";
constexpr char O_COLOR[] = "#FF5722";
constexpr char DEFAULT_COLOR[] = "#FFF";
}
struct Cell
{
QPushButton *cellBtn = nullptr;
int row = defaults::INVALID_CELL;
int col = defaults::INVALID_CELL;
Cell(QPushButton *cellBtn, int row, int col)
: cellBtn(cellBtn), row(row), col(col) {}
};
struct TTTOptions
{
size_t boardSize = defaults::DEFAULT_BOARD_SIZE;
unsigned short miniMaxDepth = defaults::DEFAULT_MINIMAX_DEPTH;
bool AIopponent = true;
bool AIstarts = false;
};
enum class BoardMarks { Empty, X, O };
enum class BoardState { NoWinner, XWins, OWins, Tie };
#endif // TTTCOMMONTYPES_H