]> git.sesse.net Git - stockfish/commitdiff
Do not send ponder move if we don't have it
authorMarco Costalba <mcostalba@gmail.com>
Sat, 19 Mar 2011 15:00:09 +0000 (16:00 +0100)
committerMarco Costalba <mcostalba@gmail.com>
Sat, 19 Mar 2011 15:08:19 +0000 (16:08 +0100)
Has been reported by Justin Blanchard that
this creates problems on some buggy GUI.

No functional change.

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

index d94128eb41c944bd34ec5d92432aad714e5efce5..9a3ecbbefaf8fecaa63b67c161731f6e5ee4b25d 100644 (file)
@@ -578,8 +578,15 @@ bool think(Position& pos, bool infinite, bool ponder, int time[], int increment[
   if (!StopRequest && (Pondering || InfiniteSearch))
       wait_for_stop_or_ponderhit();
 
-  // Could be both MOVE_NONE when searching on a stalemate position
-  cout << "bestmove " << bestMove << " ponder " << ponderMove << endl;
+  // Could be MOVE_NONE when searching on a stalemate position
+  cout << "bestmove " << bestMove;
+
+  // UCI protol is not clear on allowing sending an empty ponder move, instead
+  // it is clear that ponder move is optional. So skip it if empty.
+  if (ponderMove != MOVE_NONE)
+      cout << " ponder " << ponderMove;
+
+  cout << endl;
 
   return !QuitRequest;
 }