- 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")
- {
- push_button("Clear Hash");
- Position::init_piece_square_tables();
- RootPosition.from_fen(StartPosition);
- }
- else if (token == "isready")
- cout << "readyok" << endl;
- else if (token == "position")
- set_position(uip);
- else if (token == "setoption")
- set_option(uip);
-
- // The remaining commands are for debugging purposes only.
- // Perhaps they should be removed later in order to reduce the
- // size of the program binary.
- else if (token == "d")
- RootPosition.print();
- else if (token == "flip")
- {
- Position p(RootPosition);
- RootPosition.flipped_copy(p);
- }
- else if (token == "eval")
- {
- EvalInfo ei;
- cout << "Incremental mg: " << RootPosition.mg_value()
- << "\nIncremental eg: " << RootPosition.eg_value()
- << "\nFull eval: " << evaluate(RootPosition, ei, 0) << endl;
- }
- else if (token == "key")
- cout << "key: " << hex << RootPosition.get_key()
- << "\nmaterial key: " << RootPosition.get_material_key()
- << "\npawn key: " << RootPosition.get_pawn_key() << endl;
- else if (token == "perft")
- perft(uip);
- else
- {
- cout << "Unknown command: " << command << endl;
- while (!uip.eof())
- {
- uip >> token;
- cout << token << endl;
- }
- }
- return true;
- }