From 72b327c3ff9d20a5cb5c77252d6f562338396648 Mon Sep 17 00:00:00 2001 From: rektdie Date: Thu, 11 Apr 2024 08:10:36 +0200 Subject: [PATCH] bugfix: attackMaps wasn't updating --- source/board.cpp | 2 ++ source/main.cpp | 5 ++--- source/movegen.cpp | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/source/board.cpp b/source/board.cpp index 5034891..ff08cef 100644 --- a/source/board.cpp +++ b/source/board.cpp @@ -396,4 +396,6 @@ void Board::MakeMove(Move move) { halfMoves++; if (halfMoves & 2 == 0) fullMoves++; sideToMove = !attackerColor; + + GenAttackMaps(*this); } \ No newline at end of file diff --git a/source/main.cpp b/source/main.cpp index eeb3f2f..d8fc1a0 100644 --- a/source/main.cpp +++ b/source/main.cpp @@ -9,9 +9,8 @@ int main() { initSliderAttacks(); Board board; - board.SetByFen("r3k2r/Pppp1ppp/1b3nbN/nP6/BBP1P3/q4N2/Pp1P2PP/R2Q1R1K b kq - 1 1"); - board.PrintBoard(); - Perft(board, 2); + board.SetByFen("r3k2r/p1ppqpb1/bn2pnp1/3PN3/1p2P3/2N2Q1p/PPPBBPPP/R3K2R w KQkq - 0 1"); + Perft(board, 1); return 0; } \ No newline at end of file diff --git a/source/movegen.cpp b/source/movegen.cpp index 6738bb8..33ae226 100644 --- a/source/movegen.cpp +++ b/source/movegen.cpp @@ -825,6 +825,7 @@ static void GenCheckEvasions(Board &board, bool color) { if (checkerType == Rook || checkerType == Bishop || checkerType == Queen) { pushMask = SliderRayToSquare(checkerSquare, kingSquare); pushMask.PopBit(kingSquare); + pushMask.PopBit(checkerSquare); } // looping through own pieces to add captures and blocks @@ -854,7 +855,6 @@ static void GenCheckEvasions(Board &board, bool color) { } captures |= getPieceAttacks(square, type, color, board.occupied.GetBoard()) & captureMask; - while (captures.GetBoard()) { int captureSquare = captures.getLS1BIndex();