X-Git-Url: https://git.sesse.net/?p=stockfish;a=blobdiff_plain;f=src%2Fucioption.cpp;h=7123915933b90f59d48627cd95d42dc809b07a38;hp=8db4233af5f79f87c1d42831daf0f344bd0f42ed;hb=HEAD;hpb=2d0237db3f0e596fb06e3ffbadba84dcc4e018f6 diff --git a/src/ucioption.cpp b/src/ucioption.cpp index 8db4233a..2c840848 100644 --- a/src/ucioption.cpp +++ b/src/ucioption.cpp @@ -35,12 +35,14 @@ #include "tt.h" #include "types.h" #include "uci.h" +#include "hashprobe.h" using std::string; namespace Stockfish { UCI::OptionsMap Options; // Global object +std::unique_ptr hash_probe_thread; namespace UCI { @@ -50,7 +52,15 @@ static void on_hash_size(const Option& o) { TT.resize(size_t(o)); } static void on_logger(const Option& o) { start_logger(o); } static void on_threads(const Option& o) { Threads.set(size_t(o)); } static void on_tb_path(const Option& o) { Tablebases::init(o); } -static void on_eval_file(const Option&) { Eval::NNUE::init(); } +static void on_use_NNUE(const Option& ) { Eval::NNUE::init(); } +static void on_eval_file(const Option& ) { Eval::NNUE::init(); } +static void on_rpc_server_address(const Option& o) { + if (hash_probe_thread) { + hash_probe_thread->Shutdown(); + } + std::string addr = o; + hash_probe_thread.reset(new HashProbeThread(addr)); +} // Our case insensitive less() function as required by UCI protocol bool CaseInsensitiveLess::operator()(const string& s1, const string& s2) const { @@ -60,8 +70,7 @@ bool CaseInsensitiveLess::operator()(const string& s1, const string& s2) const { } -// UCI::init() initializes the UCI options to their hard-coded default values - +// Initializes the UCI options to their hard-coded default values void init(OptionsMap& o) { constexpr int MaxHashMB = Is64Bit ? 33554432 : 2048; @@ -74,10 +83,8 @@ void init(OptionsMap& o) { o["MultiPV"] << Option(1, 1, 500); o["Skill Level"] << Option(20, 0, 20); o["Move Overhead"] << Option(10, 0, 5000); - o["Slow Mover"] << Option(100, 10, 1000); o["nodestime"] << Option(0, 0, 10000); o["UCI_Chess960"] << Option(false); - o["UCI_AnalyseMode"] << Option(false); o["UCI_LimitStrength"] << Option(false); o["UCI_Elo"] << Option(1320, 1320, 3190); o["UCI_ShowWDL"] << Option(false); @@ -86,12 +93,12 @@ void init(OptionsMap& o) { o["Syzygy50MoveRule"] << Option(true); o["SyzygyProbeLimit"] << Option(7, 0, 7); o["EvalFile"] << Option(EvalFileDefaultName, on_eval_file); + o["RPCServerAddress"] << Option("", on_rpc_server_address); } -// operator<<() is used to print all the options default values in chronological +// Used to print all the options default values in chronological // insertion order (the idx field) and in the format defined by the UCI protocol. - std::ostream& operator<<(std::ostream& os, const OptionsMap& om) { for (size_t idx = 0; idx < om.size(); ++idx) @@ -172,7 +179,7 @@ bool Option::operator==(const char* s) const { } -// operator<<() inits options and assigns idx in the correct printing order +// Inits options and assigns idx in the correct printing order void Option::operator<<(const Option& o) { @@ -183,10 +190,9 @@ void Option::operator<<(const Option& o) { } -// operator=() updates currentValue and triggers on_change() action. It's up to +// Updates currentValue and triggers on_change() action. It's up to // the GUI to check for option's limits, but we could receive the new value // from the user by console window, so let's check the bounds anyway. - Option& Option::operator=(const string& v) { assert(!type.empty());