- cout << "id name " << engine_name()
- << "\nid author Tord Romstad, Marco Costalba, Joona Kiiski\n";
- print_uci_options();
- cout << "uciok" << endl;
- }
- else if (token == "ucinewgame")
- {
- set_option_value("New Game", "true");
- pos.from_fen(StartPositionFEN);
- }
- else if (token == "isready")
- cout << "readyok" << endl;
- else if (token == "position")
- set_position(pos, 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")
- pos.print();
- else if (token == "flip")
- {
- Position p(pos, pos.thread());
- pos.flipped_copy(p);
+ switch (tolower(str[4])) {
+ case 'n':
+ return make_promotion_move(from, to, KNIGHT);
+ case 'b':
+ return make_promotion_move(from, to, BISHOP);
+ case 'r':
+ return make_promotion_move(from, to, ROOK);
+ case 'q':
+ return make_promotion_move(from, to, QUEEN);
+ }