]> git.sesse.net Git - stockfish/blobdiff - src/search.cpp
Another attempt at evaluation shortcut
[stockfish] / src / search.cpp
index 075aa9b4422d01d490e2a1a25196e8befe7d6002..3ffd8ae4c780262937f98e7f83227017b7d29c08 100644 (file)
@@ -1102,11 +1102,12 @@ split_point_start: // At split points actual search starts from here
     Key posKey;
     Move ttMove, move, bestMove;
     Value bestValue, value, ttValue, futilityValue, futilityBase;
-    bool givesCheck, enoughMaterial, evasionPrunable;
+    bool givesCheck, enoughMaterial, evasionPrunable, fromNull;
     Depth ttDepth;
 
     ss->currentMove = bestMove = MOVE_NONE;
     ss->ply = (ss-1)->ply + 1;
+    fromNull = (ss-1)->currentMove == MOVE_NULL;
 
     // Check for an instant draw or maximum ply reached
     if (pos.is_draw<false, false>() || ss->ply > MAX_PLY)
@@ -1144,7 +1145,12 @@ split_point_start: // At split points actual search starts from here
     }
     else
     {
-        if (tte)
+        if (fromNull)
+        {
+            ss->staticEval = bestValue = -(ss-1)->staticEval;
+            ss->evalMargin = VALUE_ZERO;
+        }
+        else if (tte)
         {
             assert(tte->static_value() != VALUE_NONE || Threads.size() > 1);
 
@@ -1154,11 +1160,6 @@ split_point_start: // At split points actual search starts from here
             if (ss->staticEval == VALUE_NONE || ss->evalMargin == VALUE_NONE) // Due to a race
                 ss->staticEval = bestValue = evaluate(pos, ss->evalMargin);
         }
-        else if ((ss-1)->currentMove == MOVE_NULL)
-        {
-            ss->staticEval = bestValue = -(ss-1)->staticEval;
-            ss->evalMargin = VALUE_ZERO; // Hack, we really don't know the value
-        }
         else
             ss->staticEval = bestValue = evaluate(pos, ss->evalMargin);
 
@@ -1197,6 +1198,7 @@ split_point_start: // At split points actual search starts from here
       if (   !PvNode
           && !InCheck
           && !givesCheck
+          && !fromNull
           &&  move != ttMove
           &&  enoughMaterial
           &&  type_of(move) != PROMOTION