fixed a bug with pushing pawn moves

This commit is contained in:
rektdie committed 2024-03-28 20:14:16 +01:00
1 parent 3a5e6d4151
commit ac826394bd
1 file changed
+7 -2
+7 -2
View File
@@ -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();