]> git.sesse.net Git - stockfish/commitdiff
Fix an assert when stopping the search
authorMarco Costalba <mcostalba@gmail.com>
Sat, 6 Aug 2011 09:56:06 +0000 (10:56 +0100)
committerMarco Costalba <mcostalba@gmail.com>
Sun, 7 Aug 2011 09:36:13 +0000 (10:36 +0100)
When StopRequest is raised we cannot immediately exit the
move loop but first we need to update bestValue so to avoid
assert:

assert(bestValue > -VALUE_INFINITE && bestValue < VALUE_INFINITE);

No functional change.

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

index cc910f7d81da39c5f1d1b42ebbd36567cd6abd79..833bbba4e6f3b5d4fca4c3b2e3c35065bbb76edd 100644 (file)
@@ -1171,16 +1171,12 @@ split_point_start: // At split points actual search starts from here
       }
 
 
-      if (RootNode)
+      // Finished searching the move. If StopRequest is true, the search
+      // was aborted because the user interrupted the search or because we
+      // ran out of time. In this case, the return value of the search cannot
+      // be trusted, and we don't update the best move and/or PV.
+      if (RootNode && !StopRequest)
       {
-          // Finished searching the move. If StopRequest is true, the search
-          // was aborted because the user interrupted the search or because we
-          // ran out of time. In this case, the return value of the search cannot
-          // be trusted, and we break out of the loop without updating the best
-          // move and/or PV.
-          if (StopRequest)
-              break;
-
           // Remember searched nodes counts for this move
           RootMove* rm = Rml.find(move);
           rm->nodes += pos.nodes_searched() - nodes;