+/// execute_uci_command() takes a string as input, uses a UCIParser
+/// object to parse this text string as a UCI command, and calls
+/// the appropriate functions. In addition to the UCI commands,
+/// the function also supports a few debug commands.
+
+bool execute_uci_command(const string& cmd) {
+
+ static Position pos(StartPositionFEN, false, 0); // The root position
+ UCIParser up(cmd);
+ string token;
+
+ if (!(up >> token)) // operator>>() skips any whitespace
+ return true;
+
+ if (token == "quit")
+ return false;
+
+ if (token == "go")
+ return go(pos, up);
+
+ if (token == "uci")
+ {
+ cout << "id name " << engine_name()
+ << "\nid author Tord Romstad, Marco Costalba, Joona Kiiski\n";
+ print_uci_options();
+ cout << "uciok" << endl;
+ }
+ else if (token == "ucinewgame")
+ pos.from_fen(StartPositionFEN, false);
+
+ else if (token == "isready")
+ cout << "readyok" << endl;