From 85ae65db1dd315ea500f30226781c4c471d30c5d Mon Sep 17 00:00:00 2001 From: VoyagerOne Date: Tue, 22 Nov 2022 20:07:33 +0300 Subject: [PATCH] Skip full depth search in LMR depending on depth dynamically adjust newDepth, and skip full depth search if newDepth doesn't exceed the previous search depth. This affects the used newDepth for future searches, and influences the stat bonus for the move. Passed STC: https://tests.stockfishchess.org/tests/view/63795500aa34433735bc1cfe LLR: 2.95 (-2.94,2.94) <0.00,2.00> Total: 112776 W: 30082 L: 29663 D: 53031 Ptnml(0-2): 352, 12453, 30423, 12744, 416 Passed LTC: https://tests.stockfishchess.org/tests/view/6379ea39aa34433735bc2f9b LLR: 2.94 (-2.94,2.94) <0.50,2.50> Total: 83576 W: 22559 L: 22169 D: 38848 Ptnml(0-2): 38, 8011, 25303, 8395, 41 closes https://github.com/official-stockfish/Stockfish/pull/4240 Bench: 4390318 --- src/search.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/search.cpp b/src/search.cpp index fa87f1c3..5cef5c40 100644 --- a/src/search.cpp +++ b/src/search.cpp @@ -1188,7 +1188,11 @@ moves_loop: // When in check, search starts here // was good enough search deeper, if it was bad enough search shallower const bool doDeeperSearch = value > (alpha + 64 + 11 * (newDepth - d)); const bool doShallowerSearch = value < bestValue + newDepth; - value = -search(pos, ss+1, -(alpha+1), -alpha, newDepth + doDeeperSearch - doShallowerSearch, !cutNode); + + newDepth += doDeeperSearch - doShallowerSearch; + + if (newDepth > d) + value = -search(pos, ss+1, -(alpha+1), -alpha, newDepth, !cutNode); int bonus = value > alpha ? stat_bonus(newDepth) : -stat_bonus(newDepth);