X-Git-Url: https://git.sesse.net/?p=stockfish;a=blobdiff_plain;f=src%2Fuci.cpp;h=72e3d0bd0cd4600f5c1694c884ff769b1a1d6a66;hp=ebb74d439f0bb3d852db7f45e488af8575e5e4cf;hb=ffa75215cc06d105bc2b43ddb8ed5d4deccd8988;hpb=ed04c010eb4a569532f322f5030d468380b3ab57 diff --git a/src/uci.cpp b/src/uci.cpp index ebb74d43..72e3d0bd 100644 --- a/src/uci.cpp +++ b/src/uci.cpp @@ -67,11 +67,23 @@ void uci_loop() { is >> skipws >> token; - quit = (token == "quit"); + if (cmd == "quit" || cmd == "stop") + { + quit = (token == "quit"); + Search::Signals.stop = true; + Threads[0].wake_up(); // In case is waiting for stop or ponderhit + } - if (token == "quit" || token == "stop" || token == "ponderhit") + else if (cmd == "ponderhit") { - uci_async_command(token); + // The opponent has played the expected move. GUI sends "ponderhit" if + // we were told to ponder on the same move the opponent has played. We + // should continue searching but switching from pondering to normal search. + Search::Limits.ponder = false; // FIXME racing + + if (Search::Signals.stopOnPonderhit) + Search::Signals.stop = true; + Threads[0].wake_up(); // In case is waiting for stop or ponderhit } @@ -195,16 +207,16 @@ namespace { string token; int time[] = { 0, 0 }, inc[] = { 0, 0 }; - memset(&Limits, 0, sizeof(SearchLimits)); - SearchMoves.clear(); - RootPosition = &pos; + memset(&Search::Limits, 0, sizeof(Search::Limits)); + Search::RootMoves.clear(); + Search::RootPosition = &pos; while (is >> token) { if (token == "infinite") - Limits.infinite = true; + Search::Limits.infinite = true; else if (token == "ponder") - Limits.ponder = true; + Search::Limits.ponder = true; else if (token == "wtime") is >> time[WHITE]; else if (token == "btime") @@ -214,21 +226,21 @@ namespace { else if (token == "binc") is >> inc[BLACK]; else if (token == "movestogo") - is >> Limits.movesToGo; + is >> Search::Limits.movesToGo; else if (token == "depth") - is >> Limits.maxDepth; + is >> Search::Limits.maxDepth; else if (token == "nodes") - is >> Limits.maxNodes; + is >> Search::Limits.maxNodes; else if (token == "movetime") - is >> Limits.maxTime; + is >> Search::Limits.maxTime; else if (token == "searchmoves") while (is >> token) - SearchMoves.push_back(move_from_uci(pos, token)); + Search::RootMoves.push_back(move_from_uci(pos, token)); } - SearchMoves.push_back(MOVE_NONE); - Limits.time = time[pos.side_to_move()]; - Limits.increment = inc[pos.side_to_move()]; + Search::RootMoves.push_back(MOVE_NONE); + Search::Limits.time = time[pos.side_to_move()]; + Search::Limits.increment = inc[pos.side_to_move()]; Threads.start_thinking(); } @@ -248,7 +260,7 @@ namespace { time = get_system_time(); - n = perft(pos, depth * ONE_PLY); + n = Search::perft(pos, depth * ONE_PLY); time = get_system_time() - time;