From e1f181ee643dcaa92c606b74b3abd23dede136cd Mon Sep 17 00:00:00 2001 From: Vizvezdenec Date: Sat, 29 May 2021 06:39:14 +0300 Subject: [PATCH] Do less LMR extensions This patch restricts LMR extensions (of non-transposition table moves) from being used when the transposition table move was extended by two plies via singular extension. This may serve to limit search explosions in certain positions. This makes a lot of sense because the precondition for the tt-move to have been singular extended by two plies is that the result of the alternate search (with excluded the tt-move) has been a hard fail low: it is natural to later search less for non tt-moves in this situation. The current state of depth/extensions/reductions management is getting quite tricky in our search algo, see https://github.com/official-stockfish/Stockfish/pull/3546#issuecomment-860174549 for some discussion. Suggestions welcome! Passed STC https://tests.stockfishchess.org/tests/view/60c3f293457376eb8bcaac8d LLR: 2.95 (-2.94,2.94) <-0.50,2.50> Total: 117984 W: 9698 L: 9430 D: 98856 Ptnml(0-2): 315, 7708, 42703, 7926, 340 passed LTC https://tests.stockfishchess.org/tests/view/60c46ea5457376eb8bcaacc7 LLR: 2.97 (-2.94,2.94) <0.50,3.50> Total: 11280 W: 401 L: 302 D: 10577 Ptnml(0-2): 2, 271, 4998, 364, 5 closes https://github.com/official-stockfish/Stockfish/pull/3546 Bench: 4709974 --- src/search.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/search.cpp b/src/search.cpp index d04898e8..b8756d38 100644 --- a/src/search.cpp +++ b/src/search.cpp @@ -954,6 +954,7 @@ moves_loop: // When in check, search starts from here value = bestValue; singularQuietLMR = moveCountPruning = false; + bool doubleExtension = false; // Indicate PvNodes that will probably fail low if the node was searched // at a depth equal or greater than the current depth, and the result of this search was a fail low. @@ -1080,7 +1081,10 @@ moves_loop: // When in check, search starts from here if ( !PvNode && value < singularBeta - 93 && ss->doubleExtensions < 3) + { extension = 2; + doubleExtension = true; + } } // Multi-cut pruning @@ -1188,8 +1192,8 @@ moves_loop: // When in check, search starts from here // In general we want to cap the LMR depth search at newDepth. But if // reductions are really negative and movecount is low, we allow this move - // to be searched deeper than the first move. - Depth d = std::clamp(newDepth - r, 1, newDepth + (r < -1 && moveCount <= 5)); + // to be searched deeper than the first move, unless ttMove was extended by 2. + Depth d = std::clamp(newDepth - r, 1, newDepth + (r < -1 && moveCount <= 5 && !doubleExtension)); value = -search(pos, ss+1, -(alpha+1), -alpha, d, true); -- 2.39.2