From 3a7531cd3d320e7933590eda9d006a26624a81c0 Mon Sep 17 00:00:00 2001 From: "rektdie@gmail.com" Date: Sun, 7 Apr 2024 23:05:39 +0200 Subject: [PATCH] fixed a bug with IsPinned function --- source/movegen.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/source/movegen.cpp b/source/movegen.cpp index aecdc71..a1ce498 100644 --- a/source/movegen.cpp +++ b/source/movegen.cpp @@ -373,8 +373,8 @@ static bool IsPinned(Board &board, int square, int color) { if (attackerColor == !color && (attackerType == Rook || attackerType == Bishop || attackerType == Queen)) { pinner = true; - break; } + break; } currentSquare += -directionToKing; } @@ -452,9 +452,6 @@ static void GenCheckEvasions(Board &board, bool color) { Bitboard currentPiece = board.colors[color] & board.pieces[type]; while (currentPiece.GetBoard()) { - Bitboard captures; - Bitboard pushes; - int square = currentPiece.getLS1BIndex(); if (IsPinned(board, square, color)) { @@ -462,6 +459,9 @@ static void GenCheckEvasions(Board &board, bool color) { continue; } + Bitboard captures; + Bitboard pushes; + if (type == Pawn) { pushes |= getPawnPushes(square, color, board.occupied) & pushMask; } else {