added UnmakeMove function to unmake the last move

This commit is contained in:
rektdie committed 2024-03-31 22:44:42 +02:00
1 parent 025ae1eceb
commit 8535042c04
3 files changed
+102 -6

No files matched your search

+28
View File
@@ -31,4 +31,32 @@ public:
std::cout << squareCoords[moveFrom] << squareCoords[moveTo];
std::cout << '(' << moveTypes[moveFlags] << ")\n";
}
};
struct LastMove {
public:
int moveFrom;
int moveTo;
uint16_t moveFlags;
int attackerPiece;
int capturedPiece;
int capturedColor;
int enPassantTarget;
std::array<bool, 4> castlingRights;
LastMove(){}
LastMove(const Move move, const int capturedPiece,
const int capturedColor, const int enPassantTarget,
const std::array<bool, 4> castlingRights, int attackerPiece) {
moveFrom = move.moveFrom;
moveTo = move.moveTo;
moveFlags = move.moveFlags;
LastMove::capturedPiece = capturedPiece;
LastMove::capturedColor = capturedColor;
LastMove::enPassantTarget = enPassantTarget;
LastMove::castlingRights = castlingRights;
LastMove::attackerPiece = attackerPiece;
}
};