From c9615ab3a27aa27d8bacbfaf0892eba91f773715 Mon Sep 17 00:00:00 2001 From: Terje Date: Mon, 2 Dec 2024 02:22:55 +0100 Subject: [PATCH] Bench: 22535939 --- src/search.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/search.c b/src/search.c index b8b7008a..7135c931 100644 --- a/src/search.c +++ b/src/search.c @@ -175,6 +175,7 @@ static int Quiescence(Thread *thread, Stack *ss, int alpha, int beta) { Move bestMove = NOMOVE; Move move; while ((move = NextMove(&mp))) { + if (!MoveIsLegal(pos, move)) continue; // Avoid pruning until at least one move avoids a terminal loss score if (isLoss(bestScore)) goto search; @@ -201,8 +202,6 @@ static int Quiescence(Thread *thread, Stack *ss, int alpha, int beta) { ss->continuation = &thread->continuation[inCheck][moveIsCapture(move)][piece(move)][toSq(move)]; ss->contCorr = &thread->contCorrHistory[piece(move)][toSq(move)]; - // Recursively search the positions after making the moves, skipping illegal ones - if (!MoveIsLegal(pos, move)) continue; MakeMove(pos, move); int score = -Quiescence(thread, ss+1, -beta, -alpha); TakeMove(pos); @@ -447,6 +446,7 @@ static int AlphaBeta(Thread *thread, Stack *ss, int alpha, int beta, Depth depth if (move == ss->excluded) continue; if (root && AlreadySearchedMultiPV(thread, move)) continue; if (root && NotInSearchMoves(Limits.searchmoves, move)) continue; + if (!MoveIsLegal(pos, move)) continue; bool quiet = moveIsQuiet(move); @@ -475,8 +475,6 @@ static int AlphaBeta(Thread *thread, Stack *ss, int alpha, int beta, Depth depth continue; } - // Make the move, skipping to the next if illegal - if (!MoveIsLegal(pos, move)) continue; MakeMove(pos, move); moveCount++;