From: Fabian Fichter Date: Sat, 6 Mar 2021 09:52:50 +0000 (+0100) Subject: Fix parsing of player time in USI protocol X-Git-Url: http://winboard.nl/cgi-bin?a=commitdiff_plain;h=4f464fce39b8db5ea039d7e84c021cd16dfaba9b;p=fairystockfish.git Fix parsing of player time in USI protocol Since white and black are interchanged in the USI protocol, the parsing of the player time needs to consider that. Closes #269. --- diff --git a/src/uci.cpp b/src/uci.cpp index 1ef9100..0ab6275 100644 --- a/src/uci.cpp +++ b/src/uci.cpp @@ -134,16 +134,17 @@ namespace { limits.startTime = now(); // As early as possible! limits.banmoves = banmoves; + bool isUsi = Options["Protocol"] == "usi"; while (is >> token) if (token == "searchmoves") // Needs to be the last command on the line while (is >> token) limits.searchmoves.push_back(UCI::to_move(pos, token)); - else if (token == "wtime") is >> limits.time[WHITE]; - else if (token == "btime") is >> limits.time[BLACK]; - else if (token == "winc") is >> limits.inc[WHITE]; - else if (token == "binc") is >> limits.inc[BLACK]; + else if (token == "wtime") is >> limits.time[isUsi ? BLACK : WHITE]; + else if (token == "btime") is >> limits.time[isUsi ? WHITE : BLACK]; + else if (token == "winc") is >> limits.inc[isUsi ? BLACK : WHITE]; + else if (token == "binc") is >> limits.inc[isUsi ? WHITE : BLACK]; else if (token == "movestogo") is >> limits.movestogo; else if (token == "depth") is >> limits.depth; else if (token == "nodes") is >> limits.nodes;