From: Fabian Fichter Date: Sun, 28 Nov 2021 13:30:52 +0000 (+0100) Subject: Support time unit switch for UCCI X-Git-Url: http://winboard.nl/cgi-bin?a=commitdiff_plain;h=ee0ba01e4d3ca8af3ae46fe43f7267d944514f73;p=fairystockfish.git Support time unit switch for UCCI Closes #406. --- diff --git a/src/uci.cpp b/src/uci.cpp index 6f3564d..d7f483c 100644 --- a/src/uci.cpp +++ b/src/uci.cpp @@ -138,6 +138,7 @@ namespace { limits.banmoves = banmoves; bool isUsi = Options["Protocol"] == "usi"; + int secResolution = Options["usemillisec"] ? 1 : 1000; while (is >> token) if (token == "searchmoves") // Needs to be the last command on the line @@ -157,10 +158,10 @@ namespace { else if (token == "infinite") limits.infinite = 1; else if (token == "ponder") ponderMode = true; // UCCI commands - else if (token == "time") is >> limits.time[pos.side_to_move()]; - else if (token == "opptime") is >> limits.time[~pos.side_to_move()]; - else if (token == "increment") is >> limits.inc[pos.side_to_move()]; - else if (token == "oppinc") is >> limits.inc[~pos.side_to_move()]; + else if (token == "time") is >> limits.time[pos.side_to_move()], limits.time[pos.side_to_move()] *= secResolution; + else if (token == "opptime") is >> limits.time[~pos.side_to_move()], limits.time[~pos.side_to_move()] *= secResolution; + else if (token == "increment") is >> limits.inc[pos.side_to_move()], limits.inc[pos.side_to_move()] *= secResolution; + else if (token == "oppincrement") is >> limits.inc[~pos.side_to_move()], limits.inc[~pos.side_to_move()] *= secResolution; // USI commands else if (token == "byoyomi") { diff --git a/src/ucioption.cpp b/src/ucioption.cpp index b1ceb8c..8666eac 100644 --- a/src/ucioption.cpp +++ b/src/ucioption.cpp @@ -207,6 +207,7 @@ void init(OptionsMap& o) { #endif o["TsumeMode"] << Option(false); o["VariantPath"] << Option("", on_variant_path); + o["usemillisec"] << Option(true); // time unit for UCCI }