Fixed non UCI compliance

print `<empty>` and accept `<empty>` for UCI string options,
accepting empty strings as well. Internally use empty strings (`""`).

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

No functional change
This commit is contained in:
Andyson007
2024-07-11 10:09:57 +02:00
committed by Joost VandeVondele
parent 8d1e41458e
commit 42aae5fe8b
4 changed files with 14 additions and 5 deletions
+11 -3
View File
@@ -166,7 +166,9 @@ Option& Option::operator=(const std::string& v) {
return *this;
}
if (type != "button")
if (type == "string")
currentValue = v == "<empty>" ? "" : v;
else if (type != "button")
currentValue = v;
if (on_change)
@@ -188,10 +190,16 @@ std::ostream& operator<<(std::ostream& os, const OptionsMap& om) {
const Option& o = it.second;
os << "\noption name " << it.first << " type " << o.type;
if (o.type == "string" || o.type == "check" || o.type == "combo")
if (o.type == "check" || o.type == "combo")
os << " default " << o.defaultValue;
if (o.type == "spin")
else if (o.type == "string")
{
std::string defaultValue = o.defaultValue.empty() ? "<empty>" : o.defaultValue;
os << " default " << defaultValue;
}
else if (o.type == "spin")
os << " default " << int(stof(o.defaultValue)) << " min " << o.min << " max "
<< o.max;