]> git.sesse.net Git - stockfish/commitdiff
Separate razoring from null move
authorJoona Kiiski <joona.kiiski@gmail.com>
Wed, 24 Feb 2010 10:26:36 +0000 (12:26 +0200)
committerMarco Costalba <mcostalba@gmail.com>
Wed, 24 Feb 2010 18:24:10 +0000 (19:24 +0100)
I cannot see connection between the two.

Also add one FIXME for illogical behaviour

No functional change

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
src/search.cpp

index ebd004d39c541d5632163ffe8817f113a6891f74..7f64cd9410ae3436ee55eba00e90216c92011e66 100644 (file)
@@ -1316,6 +1316,21 @@ namespace {
         update_gains(pos, ss[ply - 1].currentMove, ss[ply - 1].eval, ss[ply].eval);
     }
 
         update_gains(pos, ss[ply - 1].currentMove, ss[ply - 1].eval, ss[ply].eval);
     }
 
+    // Step 6. Razoring
+    if (   !value_is_mate(beta)
+        && !isCheck
+        && depth < RazorDepth
+        && staticValue < beta - (0x200 + 16 * depth)
+        && ss[ply - 1].currentMove != MOVE_NULL
+        && ttMove == MOVE_NONE
+        && !pos.has_pawn_on_7th(pos.side_to_move()))
+    {
+        Value rbeta = beta - (0x200 + 16 * depth);
+        Value v = qsearch(pos, ss, rbeta-1, rbeta, Depth(0), ply, threadID);
+        if (v < rbeta)
+          return v; //FIXME: Logically should be: return (v + 0x200 + 16 * depth);
+    }
+
     // Static null move pruning. We're betting that the opponent doesn't have
     // a move that will reduce the score by more than FutilityMargins[int(depth)]
     // if we do a null move.
     // Static null move pruning. We're betting that the opponent doesn't have
     // a move that will reduce the score by more than FutilityMargins[int(depth)]
     // if we do a null move.
@@ -1374,20 +1389,6 @@ namespace {
                 return beta - 1;
         }
     }
                 return beta - 1;
         }
     }
-    // Null move search not allowed, try razoring
-    else if (   !value_is_mate(beta)
-             && !isCheck
-             && depth < RazorDepth
-             && staticValue < beta - (NullMoveMargin + 16 * depth)
-             && ss[ply - 1].currentMove != MOVE_NULL
-             && ttMove == MOVE_NONE
-             && !pos.has_pawn_on_7th(pos.side_to_move()))
-    {
-        Value rbeta = beta - (NullMoveMargin + 16 * depth);
-        Value v = qsearch(pos, ss, rbeta-1, rbeta, Depth(0), ply, threadID);
-        if (v < rbeta)
-          return v;
-    }
 
     // Go with internal iterative deepening if we don't have a TT move
     if (UseIIDAtNonPVNodes && ttMove == MOVE_NONE && depth >= 8*OnePly &&
 
     // Go with internal iterative deepening if we don't have a TT move
     if (UseIIDAtNonPVNodes && ttMove == MOVE_NONE && depth >= 8*OnePly &&