Update xboard.cpp - remove command
authorRick <rick@burlingame.xyz>
Wed, 5 Oct 2022 21:25:53 +0000 (14:25 -0700)
committerFabian Fichter <ianfab@users.noreply.github.com>
Sat, 8 Oct 2022 10:42:20 +0000 (12:42 +0200)
Adding remove command xboard sends with CTRL+X, only sent when player's turn, go back two moves to players previous turn. Allows player to go back and try different moves without engine stopping like undo, see https://www.gnu.org/software/xboard/engine-intf.html#8 for differences between undo and remove.

src/xboard.cpp

index 8368eb3..482b5e4 100644 (file)
@@ -380,6 +380,17 @@ void StateMachine::process_command(std::string token, std::istringstream& is) {
               go(analysisLimits);
       }
   }
+  else if (token == "remove")
+  {
+      stop();
+      if (moveList.size())
+      {
+          undo_move();
+          undo_move();
+          if (Options["UCI_AnalyseMode"])
+              go(analysisLimits);
+      }
+  }
   // Bughouse commands
   else if (token == "partner")
       Partner.parse_partner(is);
@@ -482,4 +493,4 @@ void StateMachine::process_command(std::string token, std::istringstream& is) {
 
 } // namespace XBoard
 
-} // namespace Stockfish
\ No newline at end of file
+} // namespace Stockfish