X-Git-Url: https://git.sesse.net/?p=stockfish;a=blobdiff_plain;f=src%2Fuci.cpp;h=34a26586a6a8295f0617b22d4945bfc16dc6af65;hp=683aac6d8d07a282428a9564f57152115fc7b569;hb=09d01ee9dc16f20962d5f5ffcb61ade56d4fa579;hpb=7f367e6019289e65b902a5ebf7e3686db5cefdef diff --git a/src/uci.cpp b/src/uci.cpp index 683aac6d..34a26586 100644 --- a/src/uci.cpp +++ b/src/uci.cpp @@ -78,7 +78,7 @@ bool execute_uci_command(const string& cmd) { else if (token == "uci") cout << "id name " << engine_name() << "\nid author " << engine_authors() - << "\n" << options_to_uci() + << "\n" << Options.print_all() << "\nuciok" << endl; else if (token == "ucinewgame") @@ -203,50 +203,48 @@ namespace { bool go(Position& pos, UCIParser& up) { string token; - Move searchMoves[MOVES_MAX]; - int movesToGo, depth, nodes, moveTime, numOfMoves; - bool infinite, ponder; - int time[2] = {0, 0}, inc[2] = {0, 0}; - - searchMoves[0] = MOVE_NONE; - infinite = ponder = false; - movesToGo = depth = nodes = moveTime = numOfMoves = 0; + SearchLimits limits; + Move searchMoves[MAX_MOVES] = { MOVE_NONE }; + Move* cur = searchMoves; + int time[] = { 0, 0 }, inc[] = { 0, 0 }; while (up >> token) { if (token == "infinite") - infinite = true; + limits.infinite = true; else if (token == "ponder") - ponder = true; + limits.ponder = true; else if (token == "wtime") - up >> time[0]; + up >> time[WHITE]; else if (token == "btime") - up >> time[1]; + up >> time[BLACK]; else if (token == "winc") - up >> inc[0]; + up >> inc[WHITE]; else if (token == "binc") - up >> inc[1]; + up >> inc[BLACK]; else if (token == "movestogo") - up >> movesToGo; + up >> limits.movesToGo; else if (token == "depth") - up >> depth; + up >> limits.maxDepth; else if (token == "nodes") - up >> nodes; + up >> limits.maxNodes; else if (token == "movetime") - up >> moveTime; + up >> limits.maxTime; else if (token == "searchmoves") { while (up >> token) - searchMoves[numOfMoves++] = move_from_uci(pos, token); + *cur++ = move_from_uci(pos, token); - searchMoves[numOfMoves] = MOVE_NONE; + *cur = MOVE_NONE; } } assert(pos.is_ok()); - return think(pos, infinite, ponder, time, inc, movesToGo, - depth, nodes, moveTime, searchMoves); + limits.time = time[pos.side_to_move()]; + limits.increment = inc[pos.side_to_move()]; + + return think(pos, limits, searchMoves); } void perft(Position& pos, UCIParser& up) {