From ac826394bd1688494e211ce8c21960e0b2d9535e Mon Sep 17 00:00:00 2001 From: "rektdie@gmail.com" Date: Thu, 28 Mar 2024 20:14:16 +0100 Subject: [PATCH] fixed a bug with pushing pawn moves --- source/movegen.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/source/movegen.cpp b/source/movegen.cpp index 7210d62..bbe7f00 100644 --- a/source/movegen.cpp +++ b/source/movegen.cpp @@ -281,8 +281,13 @@ void GenPawnMoves(Board &board, bool color) { int direction = color ? south : north; Bitboard attacks = pawnAttacks[color][square] & board.colors[!color]; - attacks |= (Bitboard::GetSquare(square + direction) - | Bitboard::GetSquare(square + 2 * direction)) & ~(board.occupied); + + Bitboard firstAhead = Bitboard::GetSquare(square + direction) & ~board.occupied; + + if (firstAhead.GetBoard()) { + attacks |= firstAhead; + attacks |= Bitboard::GetSquare(square + 2 * direction) & ~board.occupied; + } while (attacks.GetBoard()) { int targetSquare = attacks.getLS1BIndex();