From f29a0761a90bff9b42207b356961bd4b099c15ff Mon Sep 17 00:00:00 2001 From: rektdie Date: Sun, 9 Mar 2025 05:26:02 +0100 Subject: [PATCH] missed bestScore in QS move loop | bench 4110983 --- source/search.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/source/search.cpp b/source/search.cpp index 1545578..ceda5a0 100644 --- a/source/search.cpp +++ b/source/search.cpp @@ -96,11 +96,15 @@ static SearchResults Quiescence(Board board, int alpha, int beta) { int staticScore = Evaluate(board); - if (staticScore >= beta) { - return staticScore; + int bestScore = staticScore; + + if (bestScore>= beta) { + return bestScore; } - int bestScore = staticScore; + if (alpha < bestScore) { + alpha = bestScore; + } GenerateMoves(board, board.sideToMove); @@ -118,6 +122,8 @@ static SearchResults Quiescence(Board board, int alpha, int beta) { return score; } + bestScore = std::max(score, bestScore); + if (score > alpha) { alpha = score; results.bestMove = board.moveList[i];