]> git.sesse.net Git - stockfish/commitdiff
Unify Internal iterative deepening
authorMarco Costalba <mcostalba@gmail.com>
Sat, 8 May 2010 11:58:10 +0000 (12:58 +0100)
committerMarco Costalba <mcostalba@gmail.com>
Sat, 8 May 2010 12:00:07 +0000 (13:00 +0100)
No functional change.

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

index 37c3bd71bb40e2aab91f4e45751684b0e86d7ebb..eb2e358a07d307e4386fe9db5f4d01725d0e7550 100644 (file)
@@ -179,8 +179,7 @@ namespace {
   // Step 9. Internal iterative deepening
 
   // Minimum depth for use of internal iterative deepening
-  const Depth IIDDepthAtPVNodes = 5 * OnePly;
-  const Depth IIDDepthAtNonPVNodes = 8 * OnePly;
+  const Depth IIDDepth[2] = { 8 * OnePly /* non-PV */, 5 * OnePly /* PV */};
 
   // At Non-PV nodes we do an internal iterative deepening search
   // when the static evaluation is at most IIDMargin below beta.
@@ -1197,23 +1196,12 @@ namespace {
     }
 
     // Step 9. Internal iterative deepening
-    // We have different rules for PV nodes and non-pv nodes
-    if (   PvNode
-        && depth >= IIDDepthAtPVNodes
-        && ttMove == MOVE_NONE)
-    {
-        search<PV>(pos, ss, alpha, beta, depth-2*OnePly, ply, false, threadID);
-        ttMove = ss[ply].pv[ply];
-        tte = TT.retrieve(posKey);
-    }
-
-    if (   !PvNode
-        && depth >= IIDDepthAtNonPVNodes
+    if (   depth >= IIDDepth[PvNode]
         && ttMove == MOVE_NONE
-        && !isCheck
-        && ss[ply].eval >= beta - IIDMargin)
+        && (PvNode || (!isCheck && ss[ply].eval >= beta - IIDMargin)))
     {
-        search<NonPV>(pos, ss, alpha, beta, depth/2, ply, false, threadID);
+        Depth d = (PvNode ? depth - 2 * OnePly : depth / 2);
+        search<PvNode>(pos, ss, alpha, beta, d, ply, false, threadID);
         ttMove = ss[ply].pv[ply];
         tte = TT.retrieve(posKey);
     }