bugfix in check evasion

This commit is contained in:
rektdie committed 2024-04-10 09:39:07 +02:00
1 parent b4dc7125f9
commit 1a25479a8c
2 files changed
+5 -3

No files matched your search

+2 -1
View File
@@ -9,8 +9,9 @@ int main() {
initSliderAttacks();
Board board;
board.SetByFen("r3k2r/Pppp1ppp/1b3nbN/nP6/BBP1P3/q4N2/Pp1P2PP/R2Q1RK1 w kq - 0 1");
board.PrintBoard();
Perft(board, 3);
Perft(board, 1);
return 0;
}
+3 -2
View File
@@ -824,6 +824,7 @@ static void GenCheckEvasions(Board &board, bool color) {
if (checkerType == Rook || checkerType == Bishop || checkerType == Queen) {
pushMask = SliderRayToSquare(checkerSquare, kingSquare);
pushMask.PopBit(kingSquare);
}
// looping through own pieces to add captures and blocks
@@ -843,15 +844,15 @@ static void GenCheckEvasions(Board &board, bool color) {
if (type == Pawn) {
pushes |= getPawnPushes(square, color, board.occupied) & pushMask;
// Checking for en passant capture
if ((pawnAttacks[color][square]
& Bitboard::GetSquare(board.enPassantTarget)).GetBoard()) {
board.AddMove(Move(square, board.enPassantTarget, epCapture));
}
} else {
pushes |= getPieceAttacks(square, type, color, board.occupied.GetBoard()) & pushMask;
}
pushes |= getPieceAttacks(square, type, color, board.occupied.GetBoard()) & pushMask;
captures |= getPieceAttacks(square, type, color, board.occupied.GetBoard()) & captureMask;
while (captures.GetBoard()) {