From c228f3196ae9965250f317c8784012c2485228c4 Mon Sep 17 00:00:00 2001 From: Michael Chaly Date: Tue, 7 Dec 2021 19:46:21 +0300 Subject: [PATCH] Introduce post-lmr extensions This idea is somewhat similar to extentions in LMR but has a different flavour. If result of LMR was really good - thus exceeded alpha by some pretty big given margin, we can extend move after LMR in full depth search with 0 window. The idea is that this move is probably a fail high with somewhat of a big probability so extending it makes a lot of sense passed STC https://tests.stockfishchess.org/tests/view/61ad45ea56fcf33bce7d74b7 LLR: 2.94 (-2.94,2.94) <0.00,2.50> Total: 59680 W: 15531 L: 15215 D: 28934 Ptnml(0-2): 193, 6711, 15734, 6991, 211 passed LTC https://tests.stockfishchess.org/tests/view/61ad9ff356fcf33bce7d8646 LLR: 2.95 (-2.94,2.94) <0.50,3.00> Total: 59104 W: 15321 L: 14992 D: 28791 Ptnml(0-2): 53, 6023, 17065, 6364, 47 closes https://github.com/official-stockfish/Stockfish/pull/3838 bench 4881329 --- src/search.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/search.cpp b/src/search.cpp index edeed9c0..f3a96ae2 100644 --- a/src/search.cpp +++ b/src/search.cpp @@ -1165,6 +1165,8 @@ moves_loop: // When in check, search starts here // Step 15. Make the move pos.do_move(move, st, givesCheck); + bool doDeeperSearch = false; + // Step 16. Late moves reduction / extension (LMR, ~200 Elo) // We use various heuristics for the sons of a node after the first son has // been searched. In general we would like to reduce them, but there are many @@ -1237,6 +1239,7 @@ moves_loop: // When in check, search starts here // If the son is reduced and fails high it will be re-searched at full depth doFullDepthSearch = value > alpha && d < newDepth; + doDeeperSearch = value > alpha + 88; didLMR = true; } else @@ -1248,7 +1251,7 @@ moves_loop: // When in check, search starts here // Step 17. Full depth search when LMR is skipped or fails high if (doFullDepthSearch) { - value = -search(pos, ss+1, -(alpha+1), -alpha, newDepth, !cutNode); + value = -search(pos, ss+1, -(alpha+1), -alpha, newDepth + doDeeperSearch, !cutNode); // If the move passed LMR update its stats if (didLMR && !captureOrPromotion) -- 2.39.2