Use opening book when pondering
authorJoona Kiiski <joona.kiiski@gmail.com>
Sat, 6 Feb 2010 13:55:44 +0000 (15:55 +0200)
committerMarco Costalba <mcostalba@gmail.com>
Sat, 6 Feb 2010 16:39:53 +0000 (17:39 +0100)
Otherwise we will not use move given by opening book
when we receive 'ponderhit'-command.

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

index 6982082252c66a0a2434e916faa32d181b3f506a..d3b229e67edd865091d85883688cbd28cb6926c2 100644 (file)
@@ -351,7 +351,7 @@ bool think(const Position& pos, bool infinite, bool ponder, int side_to_move,
   UseTimeManagement = !ExactMaxTime && !MaxDepth && !MaxNodes && !InfiniteSearch;
 
   // Look for a book move, only during games, not tests
-  if (UseTimeManagement && !ponder && get_option_value_bool("OwnBook"))
+  if (UseTimeManagement && get_option_value_bool("OwnBook"))
   {
       Move bookMove;
       if (get_option_value_string("Book File") != OpeningBook.file_name())
@@ -360,6 +360,9 @@ bool think(const Position& pos, bool infinite, bool ponder, int side_to_move,
       bookMove = OpeningBook.get_move(pos);
       if (bookMove != MOVE_NONE)
       {
+          if (PonderSearch)
+              wait_for_stop_or_ponderhit();
+
           cout << "bestmove " << bookMove << endl;
           return true;
       }