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

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

View file

@ -20,6 +20,7 @@ Alexander Kure
Alexander Pagel (Lolligerhans) Alexander Pagel (Lolligerhans)
Alfredo Menezes (lonfom169) Alfredo Menezes (lonfom169)
Ali AlZhrani (Cooffe) Ali AlZhrani (Cooffe)
Andreas Jan van der Meulen (Andyson007)
Andreas Matthies (Matthies) Andreas Matthies (Matthies)
Andrei Vetrov (proukornew) Andrei Vetrov (proukornew)
Andrew Grant (AndyGrant) Andrew Grant (AndyGrant)

View file

@ -93,7 +93,7 @@ Engine::Engine(std::string path) :
options["UCI_LimitStrength"] << Option(false); options["UCI_LimitStrength"] << Option(false);
options["UCI_Elo"] << Option(1320, 1320, 3190); options["UCI_Elo"] << Option(1320, 1320, 3190);
options["UCI_ShowWDL"] << Option(false); options["UCI_ShowWDL"] << Option(false);
options["SyzygyPath"] << Option("<empty>", [](const Option& o) { options["SyzygyPath"] << Option("", [](const Option& o) {
Tablebases::init(o); Tablebases::init(o);
return std::nullopt; return std::nullopt;
}); });

View file

@ -1344,7 +1344,7 @@ void Tablebases::init(const std::string& paths) {
MaxCardinality = 0; MaxCardinality = 0;
TBFile::Paths = paths; TBFile::Paths = paths;
if (paths.empty() || paths == "<empty>") if (paths.empty())
return; return;
// MapB1H1H7[] encodes a square below a1-h8 diagonal to 0..27 // MapB1H1H7[] encodes a square below a1-h8 diagonal to 0..27

View file

@ -166,7 +166,9 @@ Option& Option::operator=(const std::string& v) {
return *this; return *this;
} }
if (type != "button") if (type == "string")
currentValue = v == "<empty>" ? "" : v;
else if (type != "button")
currentValue = v; currentValue = v;
if (on_change) if (on_change)
@ -188,10 +190,16 @@ std::ostream& operator<<(std::ostream& os, const OptionsMap& om) {
const Option& o = it.second; const Option& o = it.second;
os << "\noption name " << it.first << " type " << o.type; 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; 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 " os << " default " << int(stof(o.defaultValue)) << " min " << o.min << " max "
<< o.max; << o.max;