]> git.sesse.net Git - stockfish/blobdiff - src/search.cpp
Let to toggle dynamic LMR
[stockfish] / src / search.cpp
index 72530f2e94a1a324ef0c5818a2677c0aed5d543b..f52351920a369831119c2fecc65d483e626dfd9a 100644 (file)
@@ -121,6 +121,9 @@ namespace {
   // Depth limit for selective search:
   Depth SelectiveDepth = 7*OnePly;
 
+  // Use dynamic LMR?
+  const bool UseDynamicLMR = false;
+
   // Use internal iterative deepening?
   const bool UseIIDAtPVNodes = true;
   const bool UseIIDAtNonPVNodes = false;
@@ -1333,7 +1336,9 @@ namespace {
           && !move_is_killer(move, ss[ply]))
       {
           // LMR dynamic reduction
-          Depth R = (moveCount >= 2 * LMRNonPVMoves && depth > 7*OnePly ? 2*OnePly : OnePly);
+          Depth R =    UseDynamicLMR
+                    && moveCount >= 2 * LMRNonPVMoves
+                    && depth > 7*OnePly ? 2*OnePly : OnePly;
 
           ss[ply].reduction = R;
           value = -search(pos, ss, -(beta-1), newDepth-R, ply+1, true, threadID);
@@ -1450,7 +1455,11 @@ namespace {
     Value bestValue = staticValue;
 
     if (bestValue >= beta)
+    {
+        // Update transposition table before to leave
+        TT.store(pos, value_to_tt(bestValue, ply), depth, MOVE_NONE, VALUE_TYPE_EXACT);
         return bestValue;
+    }
 
     if (bestValue > alpha)
         alpha = bestValue;
@@ -1534,9 +1543,6 @@ namespace {
 
     assert(bestValue > -VALUE_INFINITE && bestValue < VALUE_INFINITE);
 
-    // Update transposition table
-    TT.store(pos, value_to_tt(bestValue, ply), depth, MOVE_NONE, VALUE_TYPE_EXACT);
-
     // Update killers only for good check moves
     Move m = ss[ply].currentMove;
     if (alpha >= beta && ok_to_history(pos, m)) // Only non capture moves are considered