+ 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;
+
+ else if (token == "position")
+ set_position(pos, up);
+
+ else if (token == "setoption")
+ set_option(up);
+
+ // The remaining commands are for debugging purposes only
+ else if (token == "d")
+ pos.print();
+
+ else if (token == "flip")
+ {
+ Position p(pos, pos.thread());
+ pos.flipped_copy(p);
+ }
+ else if (token == "eval")
+ {
+ Value evalMargin;
+ cout << "Incremental mg: " << mg_value(pos.value())
+ << "\nIncremental eg: " << eg_value(pos.value())
+ << "\nFull eval: " << evaluate(pos, evalMargin) << endl;
+ }
+ else if (token == "key")
+ cout << "key: " << hex << pos.get_key()
+ << "\nmaterial key: " << pos.get_material_key()
+ << "\npawn key: " << pos.get_pawn_key() << endl;
+
+ else if (token == "perft")
+ perft(pos, up);
+
+ else
+ cout << "Unknown command: " << cmd << endl;
+
+ return true;