|
@@ -7,17 +7,17 @@
|
|
|
using namespace std;
|
|
|
|
|
|
const map<std::string, UciParser::CommandHandler> UciParser::commandHandlers = {
|
|
|
- {"uci", &UciParser::uci },
|
|
|
- {"debug", &UciParser::debug },
|
|
|
- {"isready", &UciParser::isready },
|
|
|
- {"setoption", &UciParser::setoption },
|
|
|
- {"register", &UciParser::doNothing },
|
|
|
- {"ucinewgame", &UciParser::ucinewgame },
|
|
|
- {"position", &UciParser::position },
|
|
|
- {"go", &UciParser::go },
|
|
|
- {"stop", &UciParser::stop },
|
|
|
- {"quit", &UciParser::quit },
|
|
|
- {"getfen", &UciParser::getfen},
|
|
|
+ { "uci", &UciParser::uci },
|
|
|
+ { "debug", &UciParser::debug },
|
|
|
+ { "isready", &UciParser::isready },
|
|
|
+ { "setoption", &UciParser::setoption },
|
|
|
+ { "register", &UciParser::doNothing },
|
|
|
+ { "ucinewgame", &UciParser::ucinewgame },
|
|
|
+ { "position", &UciParser::position },
|
|
|
+ { "go", &UciParser::go },
|
|
|
+ { "stop", &UciParser::stop },
|
|
|
+ { "quit", &UciParser::quit },
|
|
|
+ { "getfen", &UciParser::getfen },
|
|
|
};
|
|
|
|
|
|
|
|
@@ -151,9 +151,7 @@ void UciParser::position(const vector<string>& args)
|
|
|
|
|
|
void UciParser::go(const vector<string>& args)
|
|
|
{
|
|
|
- if (fst) {
|
|
|
- fst->stop();
|
|
|
- }
|
|
|
+ stop({});
|
|
|
|
|
|
fst = make_unique<FixedSearchTimer>(cg, *this);
|
|
|
|
|
@@ -175,7 +173,11 @@ void UciParser::go(const vector<string>& args)
|
|
|
|
|
|
void UciParser::stop(const vector<string>& args)
|
|
|
{
|
|
|
-
|
|
|
+ if (fst) {
|
|
|
+ fst->stop();
|
|
|
+ fst->join();
|
|
|
+ fst = nullptr;
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
|