Support xboard ping command
authorFabian Fichter <ianfab@users.noreply.github.com>
Sun, 5 Jan 2020 15:10:08 +0000 (16:10 +0100)
committerFabian Fichter <ianfab@users.noreply.github.com>
Sun, 5 Jan 2020 15:10:08 +0000 (16:10 +0100)
src/xboard.cpp

index 88c5a0f..434b45e 100644 (file)
@@ -107,12 +107,18 @@ void StateMachine::process_command(Position& pos, std::string token, std::istrin
       for (std::string v : variants.get_keys())
           if (v != "chess")
               vars += "," + v;
-      sync_cout << "feature setboard=1 usermove=1 time=1 memory=1 smp=1 colors=0 draw=0 name=0 sigint=0 myname=Fairy-Stockfish variants=\""
+      sync_cout << "feature setboard=1 usermove=1 time=1 memory=1 smp=1 colors=0 draw=0 name=0 sigint=0 ping=1 myname=Fairy-Stockfish variants=\""
                 << vars << "\""
                 << Options << sync_endl
                 << "feature done=1" << sync_endl;
   }
   else if (token == "accepted" || token == "rejected" || token == "result" || token == "?") {}
+  else if (token == "ping")
+  {
+      if (!(is >> token))
+          token = "";
+      sync_cout << "pong " << token << sync_endl;
+  }
   else if (token == "new")
   {
       setboard(pos, states);