Support USI extensions
authorFabian Fichter <ianfab@users.noreply.github.com>
Thu, 30 Jan 2020 20:44:43 +0000 (21:44 +0100)
committerFabian Fichter <ianfab@users.noreply.github.com>
Thu, 30 Jan 2020 20:44:43 +0000 (21:44 +0100)
Improve Shogi GUI compatibility by supporting:
- bestmove resign
- go byoyomi

Closes #71.

src/uci.cpp

index 2b4054f..c55a08f 100644 (file)
@@ -142,6 +142,15 @@ namespace {
         else if (token == "opptime")   is >> limits.time[~pos.side_to_move()];
         else if (token == "increment") is >> limits.inc[pos.side_to_move()];
         else if (token == "oppinc")    is >> limits.inc[~pos.side_to_move()];
+        // USI commands
+        else if (token == "byoyomi")
+        {
+            int byoyomi = 0;
+            is >> byoyomi;
+            limits.inc[WHITE] = limits.inc[BLACK] = byoyomi;
+            limits.time[WHITE] += byoyomi;
+            limits.time[BLACK] += byoyomi;
+        }
 
     Threads.start_thinking(pos, states, limits, ponderMode);
   }
@@ -366,7 +375,7 @@ string UCI::move(const Position& pos, Move m) {
   Square to = to_sq(m);
 
   if (m == MOVE_NONE)
-      return "(none)";
+      return Options["Protocol"] == "usi" ? "resign" : "(none)";
 
   if (m == MOVE_NULL)
       return "0000";