-
Notifications
You must be signed in to change notification settings - Fork 0
/
BoardState.cpp
119 lines (94 loc) · 2.77 KB
/
BoardState.cpp
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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
#include "BoardState.h"
#include "Board.h"
BoardState::~BoardState() {
for (int x = 0; x < Board::boardXBoxes; x++) {
delete[] board[x];
}
delete[] board;
}
uint8_t** BoardState::getBoard() {
return board;
}
void BoardState::setBoard(uint8_t** newBoard) {
board = newBoard;
}
void BoardState::setCurrentTurn(char newTurn) {
currentTurn = newTurn;
}
char BoardState::getCurrentTurn() {
return currentTurn;
}
bool BoardState::getWhiteCanKingsideCastle() {
return whiteCanKingsideCastle;
}
void BoardState::setWhiteCanKingsideCastle(bool newSet) {
whiteCanKingsideCastle = newSet;
}
void BoardState::setWhiteCanQueensideCastle(bool newSet) {
whiteCanQueensideCastle = newSet;
}
bool BoardState::getWhiteCanQueensideCastle() {
return whiteCanQueensideCastle;
}
bool BoardState::getBlackCanKingsideCastle() {
return blackCanKingsideCastle;
}
void BoardState::setBlackCanKingsideCastle(bool newSet) {
blackCanKingsideCastle = newSet;
}
void BoardState::setBlackCanQueensideCastle(bool newSet) {
blackCanQueensideCastle = newSet;
}
bool BoardState::getBlackCanQueensideCastle() {
return blackCanQueensideCastle;
}
int BoardState::getEnPassantX() {
return enPassantX;
}
void BoardState::setEnPassantX(int newSet) {
enPassantX = newSet;
}
int BoardState::getEnPassantY() {
return enPassantY;
}
void BoardState::setEnPassantY(int newSet) {
enPassantY = newSet;
}
int BoardState::getHalfMoveClock() {
return halfMoveClock;
}
void BoardState::setHalfMoveClock(int newSet) {
halfMoveClock = newSet;
}
int BoardState::getFullMoveClock() {
return fullMoveClock;
}
void BoardState::setFullMoveCLock(int newSet) {
fullMoveClock = newSet;
}
BoardState* BoardState::copyBoardState(BoardState* currentBoardState) {
BoardState* newState = new BoardState();
newState->currentTurn = currentBoardState->currentTurn;
newState->whiteCanKingsideCastle = currentBoardState->whiteCanKingsideCastle;
newState->whiteCanQueensideCastle = currentBoardState->whiteCanQueensideCastle;
newState->blackCanKingsideCastle = currentBoardState->blackCanKingsideCastle;
newState->blackCanQueensideCastle = currentBoardState->blackCanQueensideCastle;
newState->enPassantX = currentBoardState->enPassantX;
newState->enPassantY = currentBoardState->enPassantY;
newState->halfMoveClock = currentBoardState->halfMoveClock;
newState->fullMoveClock = currentBoardState->fullMoveClock;
newState->board = new uint8_t* [Board::boardXBoxes];
for (int x = 0; x < Board::boardXBoxes; x++) {
(newState->board)[x]= new uint8_t[Board::boardYBoxes];
}
for (int x = 0; x < Board::boardXBoxes; x++) {
for (int y = 0; y < Board::boardYBoxes; y++) {
(newState->board)[x][y] = (currentBoardState->board)[x][y];
}
}
newState->depth = currentBoardState->depth + 1;
return newState;
}
int BoardState::getDepth() {
return depth;
}