]> git.sesse.net Git - stockfish/commitdiff
Fix silly bug in uci loop
authorMarco Costalba <mcostalba@gmail.com>
Fri, 5 Aug 2011 06:15:45 +0000 (07:15 +0100)
committerMarco Costalba <mcostalba@gmail.com>
Fri, 5 Aug 2011 06:15:45 +0000 (07:15 +0100)
After issuing "go"-command, at the end of the search
SF shows: "Unknown command: ...".

Spotted by Joona.

No functional change.

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

index d7c65e10e066810811def3763f3685c24ca10492..dbf735af15a018b487a9b0df4574e60534fa89ae 100644 (file)
@@ -58,20 +58,21 @@ void uci_loop() {
 
   Position pos(StarFEN, false, 0); // The root position
   string cmd, token;
 
   Position pos(StarFEN, false, 0); // The root position
   string cmd, token;
+  bool quit = false;
 
 
-  while (getline(cin, cmd))
+  while (!quit && getline(cin, cmd))
   {
       istringstream is(cmd);
 
       is >> skipws >> token;
 
       if (token == "quit")
   {
       istringstream is(cmd);
 
       is >> skipws >> token;
 
       if (token == "quit")
-          break;
+          quit = true;
 
 
-      if (token == "go" && !go(pos, is))
-          break;
+      else if (token == "go")
+          quit = !go(pos, is);
 
 
-      if (token == "ucinewgame")
+      else if (token == "ucinewgame")
           pos.from_fen(StarFEN, false);
 
       else if (token == "isready")
           pos.from_fen(StarFEN, false);
 
       else if (token == "isready")