From: Shahin M. Shahin <41402573+peregrineshahin@users.noreply.github.com> Date: Thu, 27 Jul 2023 03:21:54 +0000 (+0300) Subject: Fix greater than TB scores in null move pruning. X-Git-Url: https://git.sesse.net/?p=stockfish;a=commitdiff_plain;h=a4fedd8152e717a37ec8b8ddda0658364c1f5ee4 Fix greater than TB scores in null move pruning. This patch is a simplification and a fix to dealing with null moves scores that returns proven mates or TB scores by preventing 'null move pruning' if the nullvalue is in that range. Current solution downgrades nullValues on the non-PV node but the value can be used in a transposed PV-node to the same position afterwards (Triangulation), the later is prone to propagate a wrong score (96.05) to root that will not be refuted unless we search further. Score of (96.05) can be obtained be two methods, maxim static-eval returned on Pv update (mostly qSearch) this downgrade (clamp) in NMP and theoretically can happen with or without TBs but the second scenario is more dangerous than the first. This fixes the reproducible case in very common scenarios with TBs as shown in the debugging at discord. Fixes: #4699 Passed STC: https://tests.stockfishchess.org/tests/view/64c1eca8dc56e1650abba6f9 LLR: 2.94 (-2.94,2.94) <-1.75,0.25> Total: 670048 W: 171132 L: 171600 D: 327316 Ptnml(0-2): 2134, 75687, 179820, 75279, 2104 Passed LTC: https://tests.stockfishchess.org/tests/view/64c5e130dc56e1650abc0438 LLR: 2.95 (-2.94,2.94) <-1.75,0.25> Total: 92868 W: 23642 L: 23499 D: 45727 Ptnml(0-2): 52, 9509, 27171, 9648, 54 closes https://github.com/official-stockfish/Stockfish/pull/4715 Bench: 1327410 --- diff --git a/src/search.cpp b/src/search.cpp index a1834ab9..1b019a08 100644 --- a/src/search.cpp +++ b/src/search.cpp @@ -812,11 +812,9 @@ namespace { pos.undo_null_move(); - if (nullValue >= beta) + // Do not return unproven mate or TB scores + if (nullValue >= beta && nullValue < VALUE_TB_WIN_IN_MAX_PLY) { - // Do not return unproven mate or TB scores - nullValue = std::min(nullValue, VALUE_TB_WIN_IN_MAX_PLY-1); - if (thisThread->nmpMinPly || depth < 14) return nullValue;