diff --git a/src/search.cpp b/src/search.cpp index a5b07d2f..3874852b 100644 --- a/src/search.cpp +++ b/src/search.cpp @@ -517,13 +517,6 @@ namespace { 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(thisThread)->check_time(); @@ -560,6 +553,13 @@ namespace { (ss+2)->killers[0] = (ss+2)->killers[1] = MOVE_NONE; Square prevSq = to_sq((ss-1)->currentMove); + // 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. + (ss+2)->statScore = 0; + // Step 4. Transposition table lookup. We don't want the score of a partial // search to overwrite a previous full search TT value, so we use a different // position key in case of an excluded move.