]> git.sesse.net Git - stockfish/commitdiff
Another attempt at evaluation shortcut
authorMarco Costalba <mcostalba@gmail.com>
Mon, 5 Nov 2012 09:13:48 +0000 (10:13 +0100)
committerMarco Costalba <mcostalba@gmail.com>
Mon, 5 Nov 2012 15:12:28 +0000 (16:12 +0100)
In this case we try a rather drastic
approach: we simply don't futility prune
in qsearch when arriving from a null move.

So we save evaluating and also save to mess
with eval margins at all because margin is used
only in futility.

Also accuracy should not be affected, actually it
improves because we don't prune anything anymore.

bench: 5404066

src/search.cpp

index 253311ae11c9ff122a4f40db5ab4e3bc07ef81e5..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;
     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;
     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)
 
     // 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
     {
     }
     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);
 
         {
             assert(tte->static_value() != VALUE_NONE || Threads.size() > 1);
 
@@ -1192,6 +1198,7 @@ split_point_start: // At split points actual search starts from here
       if (   !PvNode
           && !InCheck
           && !givesCheck
       if (   !PvNode
           && !InCheck
           && !givesCheck
+          && !fromNull
           &&  move != ttMove
           &&  enoughMaterial
           &&  type_of(move) != PROMOTION
           &&  move != ttMove
           &&  enoughMaterial
           &&  type_of(move) != PROMOTION