-
Notifications
You must be signed in to change notification settings - Fork 0
/
StoreMove.cpp
223 lines (184 loc) · 6.12 KB
/
StoreMove.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
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
#include "StoreMove.h"
void StoreMove::init(StoreMove* nextStore, Move newMove, bool updatedKing, bool updatedQueen, Box previousPassant, bool took, uint8_t piece) {
next = nextStore;
move = {
{
newMove.fromBox.x,
newMove.fromBox.y
},
{newMove.toBox.x,
newMove.fromBox.y},
newMove.kingSideCastle,
newMove.queenSideCastle,
newMove.enPassant,
newMove.isPromotion,
newMove.promotionType
};
previousWhiteKingSide = previousBlackKingSide = previousWhiteQueenSide = previousBlackQueenSide = false;
previousEnPassant = { previousPassant.x,previousPassant.y };
tookAPiece = took;
pieceTaken = piece;
}
StoreMove::StoreMove() {
}
void StoreMove::setNext(StoreMove* newNext) {
next = newNext;
}
StoreMove* StoreMove::getNext() {
return next;
}
Move StoreMove::getMove() {
return move;
}
bool StoreMove::tookPiece() {
return tookAPiece;
}
Box StoreMove::getPreviousEnPassant() {
return previousEnPassant;
}
bool StoreMove::getPreviousWhiteKingSide() {
return previousWhiteKingSide;
}
bool StoreMove::getPreviousBlackKingSide() {
return previousBlackKingSide;
}
bool StoreMove::getPreviousWhiteQueenSide() {
return previousWhiteQueenSide;
}
bool StoreMove::getPreviousBlackQueenSide() {
return previousBlackQueenSide;
}
uint8_t StoreMove::getTakenPiece() {
return pieceTaken;
}
void StoreMove::setMove(Move newMove) {
move = {
{
newMove.fromBox.x,
newMove.fromBox.y
},
{newMove.toBox.x,
newMove.toBox.y },
newMove.kingSideCastle,
newMove.queenSideCastle,
newMove.enPassant,
newMove.isPromotion,
newMove.promotionType
};
}
void StoreMove::setPreviousCastles(bool whiteKing, bool whiteQueen, bool blackKing, bool blackQueen) {
previousWhiteKingSide = whiteKing;
previousWhiteQueenSide = whiteQueen;
previousBlackKingSide = blackKing;
previousBlackQueenSide = blackQueen;
}
void StoreMove::setPreviousEnPassant(Box newBox) {
previousEnPassant = { newBox.x,newBox.y };
}
void StoreMove::setTookPiece(bool newSet) {
tookAPiece = newSet;
}
void StoreMove::setPieceTaken(uint8_t newPiece) {
pieceTaken = newPiece;
}
void StoreMove::setThreatInfo(uint8_t whiteThreatened, uint8_t blackThreatened, uint8_t whiteAttacked, uint8_t blackAttacked, int amountAttacked, bool attackedByKnight,Box attackedFromBox) {
previousWhiteThreatenedInfo = whiteThreatened;
previousBlackThreatenedInfo = blackThreatened;
previousWhiteAttackedInfo = whiteAttacked;
previousBlackAttackedInfo = blackAttacked;
previousAmountAttacked = amountAttacked;
previousAttackedByKnight = attackedByKnight;
previousAttackedFromBox = { attackedFromBox.x,attackedFromBox.y };
}
bool StoreMove::getPreviousAttackedByKnight() {
return previousAttackedByKnight;
}
uint8_t StoreMove::getPreviousWhiteThreatenedInfo() {
return previousWhiteThreatenedInfo;
}
uint8_t StoreMove::getPreviousBlackThreatenedInfo() {
return previousBlackThreatenedInfo;
}
uint8_t StoreMove::getPreviousWhiteAttackedInfo() {
return previousWhiteAttackedInfo;
}
uint8_t StoreMove::getPreviousBlackAttackedInfo() {
return previousBlackAttackedInfo;
}
int StoreMove::getPreviousAmountAttacked() {
return previousAmountAttacked;
}
Box StoreMove::getPreviousAttackedFromBox() {
return previousAttackedFromBox;
}
void StoreMove::setThreatBoxes(Box whiteStraightLeftBox, Box whiteUpLeftBox, Box whiteStraightUpBox,
Box whiteUpRightBox, Box whiteStraightRightBox, Box whiteDownRightBox,
Box whiteStraightDownBox, Box whiteDownLeftBox,
Box blackStraightLeftBox, Box blackUpLeftBox, Box blackStraightUpBox,
Box blackUpRightBox, Box blackStraightRightBox, Box blackDownRightBox,
Box blackStraightDownBox, Box blackDownLeftBox) {
previousWhiteStraightLeftBox = { whiteStraightLeftBox.x, whiteStraightLeftBox.y };
previousWhiteStraightRightBox = { whiteStraightRightBox.x,whiteStraightRightBox.y };
previousWhiteStraightUpBox = { whiteStraightUpBox.x,whiteStraightUpBox.y };
previousWhiteStraightDownBox = { whiteStraightDownBox.x, whiteStraightDownBox.y };
previousWhiteUpLeftBox = { whiteUpLeftBox.x,whiteUpLeftBox.y };
previousWhiteUpRightBox = { whiteUpRightBox.x,whiteUpRightBox.y };
previousWhiteDownLeftBox = { whiteDownLeftBox.x,whiteDownLeftBox.y };
previousWhiteDownRightBox = { whiteDownRightBox.x,whiteDownRightBox.y };
previousBlackStraightLeftBox = { blackStraightLeftBox.x, blackStraightLeftBox.y };
previousBlackStraightRightBox = { blackStraightRightBox.x,blackStraightRightBox.y};
previousBlackStraightUpBox = { blackStraightUpBox.x,blackStraightUpBox.y };
previousBlackStraightDownBox = { blackStraightDownBox.x, blackStraightDownBox.y };
previousBlackUpLeftBox = { blackUpLeftBox.x,blackUpLeftBox.y };
previousBlackUpRightBox = { blackUpRightBox.x,blackUpRightBox.y };
previousBlackDownLeftBox = { blackDownLeftBox.x,blackDownLeftBox.y };
previousBlackDownRightBox = { blackDownRightBox.x,blackDownRightBox.y };
}
Box StoreMove::getPreviousWhiteStraightLeftBox() {
return previousWhiteStraightLeftBox;
}
Box StoreMove::getPreviousWhiteStraightDownBox() {
return previousWhiteStraightDownBox;
}
Box StoreMove::getPreviousWhiteStraightRightBox() {
return previousWhiteStraightRightBox;
}
Box StoreMove::getPreviousWhiteStraightUpBox() {
return previousWhiteStraightUpBox;
}
Box StoreMove::getPreviousWhiteUpLeftBox() {
return previousWhiteUpLeftBox;
}
Box StoreMove::getPreviousWhiteDownLeftBox() {
return previousWhiteDownLeftBox;
}
Box StoreMove::getPreviousWhiteDownRightBox() {
return previousWhiteDownRightBox;
}
Box StoreMove::getPreviousWhiteUpRightBox() {
return previousWhiteUpRightBox;
}
Box StoreMove::getPreviousBlackStraightLeftBox() {
return previousBlackStraightLeftBox;
}
Box StoreMove::getPreviousBlackStraightDownBox() {
return previousBlackStraightDownBox;
}
Box StoreMove::getPreviousBlackStraightRightBox() {
return previousBlackStraightRightBox;
}
Box StoreMove::getPreviousBlackStraightUpBox() {
return previousBlackStraightUpBox;
}
Box StoreMove::getPreviousBlackUpLeftBox() {
return previousBlackUpLeftBox;
}
Box StoreMove::getPreviousBlackDownLeftBox() {
return previousBlackDownLeftBox;
}
Box StoreMove::getPreviousBlackDownRightBox() {
return previousBlackDownRightBox;
}
Box StoreMove::getPreviousBlackUpRightBox() {
return previousBlackUpRightBox;
}