]> git.sesse.net Git - stockfish/blobdiff - src/search.cpp
Stat score initialization: children
[stockfish] / src / search.cpp
index 394f228fb4f59956914ab3d014b199934d245716..a5b07d2f18c30185d2da0192076dd612578a0480 100644 (file)
@@ -514,10 +514,16 @@ namespace {
     Thread* thisThread = pos.this_thread();
     inCheck = pos.checkers();
     moveCount = captureCount = quietCount = ss->moveCount = 0;
-    ss->statScore = 0;
     bestValue = -VALUE_INFINITE;
     maxValue = VALUE_INFINITE;
 
+    // Initialize statScore to zero for the childs of the current position.
+    // So statScore is shared between sibling positions and only the first sibling
+    // starts with statScore = 0. Later siblings start with the last calculated
+    // statScore of the previous sibling. This influences in LMR the reduction rules
+    // which based on the statScore of parent position.
+    (ss+1)->statScore = 0;
+
     // Check for the available remaining time
     if (thisThread == Threads.main())
         static_cast<MainThread*>(thisThread)->check_time();