]> git.sesse.net Git - stockfish/commitdiff
Move invariant of singular ext. check out of loop
authorMarco Costalba <mcostalba@gmail.com>
Tue, 1 Jun 2010 14:31:24 +0000 (15:31 +0100)
committerMarco Costalba <mcostalba@gmail.com>
Tue, 1 Jun 2010 14:47:28 +0000 (15:47 +0100)
It is almost always false.

No functional change.

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

index 4550f5f7002ac39adc345efa8205b0990becee42..d0cedb82601d5b2526bdc608cd3f50106a00b793 100644 (file)
@@ -1229,6 +1229,11 @@ namespace {
     // Initialize a MovePicker object for the current position
     MovePicker mp = MovePicker(pos, ttMove, depth, H, ss, (PvNode ? -VALUE_INFINITE : beta));
     CheckInfo ci(pos);
     // Initialize a MovePicker object for the current position
     MovePicker mp = MovePicker(pos, ttMove, depth, H, ss, (PvNode ? -VALUE_INFINITE : beta));
     CheckInfo ci(pos);
+    bool singularExtensionNode =   depth >= SingularExtensionDepth[PvNode]
+                                && tte && tte->move()
+                                && !excludedMove // Do not allow recursive singular extension search
+                                && is_lower_bound(tte->type())
+                                && tte->depth() >= depth - 3 * OnePly;
 
     // Step 10. Loop through moves
     // Loop through all legal moves until no moves remain or a beta cutoff occurs
 
     // Step 10. Loop through moves
     // Loop through all legal moves until no moves remain or a beta cutoff occurs
@@ -1251,13 +1256,9 @@ namespace {
       // Singular extension search. We extend the TT move if its value is much better than
       // its siblings. To verify this we do a reduced search on all the other moves but the
       // ttMove, if result is lower then ttValue minus a margin then we extend ttMove.
       // Singular extension search. We extend the TT move if its value is much better than
       // its siblings. To verify this we do a reduced search on all the other moves but the
       // ttMove, if result is lower then ttValue minus a margin then we extend ttMove.
-      if (   depth >= SingularExtensionDepth[PvNode]
-          && tte
+      if (   singularExtensionNode
           && move == tte->move()
           && move == tte->move()
-          && !excludedMove // Do not allow recursive singular extension search
-          && ext < OnePly
-          && is_lower_bound(tte->type())
-          && tte->depth() >= depth - 3 * OnePly)
+          && ext < OnePly)
       {
           Value ttValue = value_from_tt(tte->value(), ply);
 
       {
           Value ttValue = value_from_tt(tte->value(), ply);
 
@@ -1346,12 +1347,12 @@ namespace {
                   value = -search<NonPV>(pos, ss+1, -(alpha+1), -alpha, newDepth-ss->reduction, true, threadID);
                   doFullDepthSearch = (value > alpha);
               }
                   value = -search<NonPV>(pos, ss+1, -(alpha+1), -alpha, newDepth-ss->reduction, true, threadID);
                   doFullDepthSearch = (value > alpha);
               }
+              ss->reduction = Depth(0); // Restore original reduction
           }
 
           // Step 15. Full depth search
           if (doFullDepthSearch)
           {
           }
 
           // Step 15. Full depth search
           if (doFullDepthSearch)
           {
-              ss->reduction = Depth(0);
               value = newDepth < OnePly ? -qsearch<NonPV>(pos, ss+1, -(alpha+1), -alpha, Depth(0), threadID)
                                         : - search<NonPV>(pos, ss+1, -(alpha+1), -alpha, newDepth, true, threadID);
 
               value = newDepth < OnePly ? -qsearch<NonPV>(pos, ss+1, -(alpha+1), -alpha, Depth(0), threadID)
                                         : - search<NonPV>(pos, ss+1, -(alpha+1), -alpha, newDepth, true, threadID);