From 1b5738e0c958ac8d3d140a3d182b85f8c0c0cd2c Mon Sep 17 00:00:00 2001 From: Michael Chaly Date: Fri, 24 Mar 2023 07:45:22 +0300 Subject: [PATCH] Simplify statScore initialization This patch simplifies initialization of statScore to "always set it up to 0" instead of setting it up to 0 two plies deeper. Reason for why it was done in previous way partially was because of LMR usage of previous statScore which was simplified long time ago so it makes sense to make in more simple there. Passed STC: https://tests.stockfishchess.org/tests/view/641a86d1db43ab2ba6f7b31d LLR: 2.95 (-2.94,2.94) <-1.75,0.25> Total: 115648 W: 30895 L: 30764 D: 53989 Ptnml(0-2): 368, 12741, 31473, 12876, 366 Passed LTC: https://tests.stockfishchess.org/tests/view/641b1c31db43ab2ba6f7d17a LLR: 2.96 (-2.94,2.94) <-1.75,0.25> Total: 175576 W: 47122 L: 47062 D: 81392 Ptnml(0-2): 91, 17077, 53390, 17141, 89 closes https://github.com/official-stockfish/Stockfish/pull/4460 bench 5081969 --- src/search.cpp | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/src/search.cpp b/src/search.cpp index b2983f66..d2358ea2 100644 --- a/src/search.cpp +++ b/src/search.cpp @@ -607,14 +607,7 @@ namespace { (ss+2)->cutoffCnt = 0; ss->doubleExtensions = (ss-1)->doubleExtensions; Square prevSq = is_ok((ss-1)->currentMove) ? to_sq((ss-1)->currentMove) : SQ_NONE; - - // Initialize statScore to zero for the grandchildren of the current position. - // So statScore is shared between all grandchildren and only the first grandchild - // starts with statScore = 0. Later grandchildren start with the last calculated - // statScore of the previous grandchild. This influences the reduction rules in - // LMR which are based on the statScore of parent position. - if (!rootNode) - (ss+2)->statScore = 0; + ss->statScore = 0; // Step 4. Transposition table lookup. excludedMove = ss->excludedMove; -- 2.39.2