-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBoard.h
More file actions
81 lines (66 loc) · 1.63 KB
/
Board.h
File metadata and controls
81 lines (66 loc) · 1.63 KB
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
#pragma once
#include <vector>
#include "Logger.h"
class Validator;
class Board {
public:
std::vector<std::vector<char>> board;
bool isValid = false;
struct BoardInfo {
int dimension;
int pawnsToCapture;
int pawns[2];
int reserve[2];
char activePlayer;
} boardInfo{};
struct BoardExpectedValues {
std::vector<int> rowWidth;
int pawnsInTotal[2];
} boardExpectedValues{};
struct Position {
mutable int row, col;
void Print() const {
std::cout << row << ", " << col << std::endl;
}
bool operator==(const Position& other) const {
return (row == other.row && col == other.col);
}
bool operator!=(const Position& other) const {
return (row != other.row || col != other.col);
}
int& operator[](int indx) const {
if (indx == 0) return row;
return col;
}
};
struct Move {
std::string from;
std::string to;
Position fPosition;
Position tPosition;
struct PawnCollectInfo {
char color = 0;
std::string from;
std::string to;
Position fPosition;
Position tPosition;
} pawnCollectInfo;
} move;
struct Visited {
bool visitDirection[3] = {};
};
public:
void PrintGameState() const;
void Clear();
void PrintBoard() const;
void PrintBoardInfo() const;
void PrintBoardDev() const;
Position FieldDecoder(const std::string& field) const;
void SetMove(const std::string& from, const std::string& to);
void MakeMove();
void MoveRow(int rowOffset, int colOffset, bool isCorner);
void NextPlayer();
void SetPawnCollectInfo(char color, const std::string& from, const std::string& to);
bool operator==(const Board& other) const;
bool operator!=(const Board& other) const;
};