]> git.sesse.net Git - stockfish/commitdiff
Fix extract_ponder_from_tt()
authorjoergoster <osterj165@googlemail.com>
Sat, 9 Jul 2016 19:01:42 +0000 (21:01 +0200)
committerMarco Costalba <mcostalba@gmail.com>
Tue, 12 Jul 2016 06:47:21 +0000 (08:47 +0200)
Checking for legality of a possible ponder move
must be done before we undo the first pv move,
of course. (spotted by mohammed li.)

This obviously only has any effect when playing in ponder mode.

No functional change.

src/search.cpp

index 97ab5918ae808090ca181aab078e35f15f8399d4..b735281729e78387359866d60d36f20d936e6165 100644 (file)
@@ -1574,16 +1574,16 @@ bool RootMove::extract_ponder_from_tt(Position& pos)
 
     pos.do_move(pv[0], st, pos.gives_check(pv[0], CheckInfo(pos)));
     TTEntry* tte = TT.probe(pos.key(), ttHit);
 
     pos.do_move(pv[0], st, pos.gives_check(pv[0], CheckInfo(pos)));
     TTEntry* tte = TT.probe(pos.key(), ttHit);
-    pos.undo_move(pv[0]);
 
     if (ttHit)
     {
         Move m = tte->move(); // Local copy to be SMP safe
         if (MoveList<LEGAL>(pos).contains(m))
 
     if (ttHit)
     {
         Move m = tte->move(); // Local copy to be SMP safe
         if (MoveList<LEGAL>(pos).contains(m))
-           return pv.push_back(m), true;
+            pv.push_back(m);
     }
 
     }
 
-    return false;
+    pos.undo_move(pv[0]);
+    return pv.size() > 1;
 }
 
 void Tablebases::filter_root_moves(Position& pos, Search::RootMoves& rootMoves) {
 }
 
 void Tablebases::filter_root_moves(Position& pos, Search::RootMoves& rootMoves) {