1
0
Fork 0
mirror of https://github.com/sockspls/badfish synced 2025-04-29 16:23:09 +00:00

Fix some more UCI output

further fall-out of the refactoring, fixes:

* the position object in UCI is not never getting updated if position token is used
* duplicate string of " wdl "

See also:

https://discord.com/channels/435943710472011776/1032922913499783169/1228227522945351690
https://discord.com/channels/435943710472011776/813919248455827515/1228288106449338398

closes https://github.com/official-stockfish/Stockfish/pull/5168

No functional change

Co-Authored-By: disservin <45608332+disservin@users.noreply.github.com>
This commit is contained in:
Shahin M. Shahin 2024-04-12 13:32:31 +03:00 committed by Joost VandeVondele
parent e58b3b4665
commit 14f6eab07d
2 changed files with 6 additions and 5 deletions

View file

@ -137,7 +137,7 @@ void UCIEngine::loop() {
else if (token == "go")
go(pos, is);
else if (token == "position")
position(is);
position(pos, is);
else if (token == "ucinewgame")
engine.search_clear();
else if (token == "isready")
@ -268,7 +268,7 @@ void UCIEngine::bench(Position& pos, std::istream& args) {
else if (token == "setoption")
setoption(is);
else if (token == "position")
position(is);
position(pos, is);
else if (token == "ucinewgame")
{
engine.search_clear(); // search_clear may take a while
@ -294,7 +294,7 @@ void UCIEngine::setoption(std::istringstream& is) {
engine.get_options().setoption(is);
}
void UCIEngine::position(std::istringstream& is) {
void UCIEngine::position(Position& pos, std::istringstream& is) {
std::string token, fen;
is >> token;
@ -317,6 +317,7 @@ void UCIEngine::position(std::istringstream& is) {
moves.push_back(token);
}
pos.set(fen, engine.get_options()["UCI_Chess960"], pos.state());
engine.set_position(fen, moves);
}
@ -393,7 +394,7 @@ std::string UCIEngine::wdl(Value v, const Position& pos) {
int wdl_w = win_rate_model(v, pos);
int wdl_l = win_rate_model(-v, pos);
int wdl_d = 1000 - wdl_w - wdl_l;
ss << " wdl " << wdl_w << " " << wdl_d << " " << wdl_l;
ss << wdl_w << " " << wdl_d << " " << wdl_l;
return ss.str();
}

View file

@ -58,7 +58,7 @@ class UCIEngine {
void go(Position& pos, std::istringstream& is);
void bench(Position& pos, std::istream& args);
void position(std::istringstream& is);
void position(Position& pos, std::istringstream& is);
void setoption(std::istringstream& is);
static void on_update_no_moves(const Engine::InfoShort& info);