]> git.sesse.net Git - stockfish/commitdiff
Don't save stale value in TT after split
authorMarco Costalba <mcostalba@gmail.com>
Thu, 1 May 2014 14:25:17 +0000 (16:25 +0200)
committerMarco Costalba <mcostalba@gmail.com>
Thu, 1 May 2014 14:26:18 +0000 (16:26 +0200)
If we return from split with a stale value
due to a stop or a cutoff upstream occurred,
then we exit moves loop and save a stale value
in TT before returning search().

This patch, from Joona, fixes this.

bench: 8678654

src/search.cpp

index d4cac16dd55bf4eed972cf2b44367c3a5209eca7..dbc9f0c6d9610499fdc2c389d1b467647bd1039c 100644 (file)
@@ -940,7 +940,7 @@ moves_loop: // When in check and at SpNode search starts from here
       // value of the search cannot be trusted, and we return immediately without
       // updating best move, PV and TT.
       if (Signals.stop || thisThread->cutoff_occurred())
-          return VALUE_DRAW;
+          return VALUE_ZERO;
 
       if (RootNode)
       {
@@ -997,6 +997,10 @@ moves_loop: // When in check and at SpNode search starts from here
 
           thisThread->split<FakeSplit>(pos, ss, alpha, beta, &bestValue, &bestMove,
                                        depth, moveCount, &mp, NT, cutNode);
+
+          if (Signals.stop || thisThread->cutoff_occurred())
+              return VALUE_ZERO;
+
           if (bestValue >= beta)
               break;
       }