Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Change the operators of the Option type in uci.h to accept floating point numbers in double precision on input as the numerical type for the "spin" values of the UCI protocol. The output of Stockfish after the "uci" command is unaffected. This change is compatible with all the existing GUI (as they will continue sending integers that we can interpret as doubles in SF), and allows us to pass double parameters to Stockfish in the console via the "setoption" command. This will be useful if we implement another tuner as an alternative for SPSA. Closes #1556 No functional change. --------------------- A example of the new functionality in action in the branch `tune_float2'`: snicolet/Stockfish@876c322 I have added the following lines in ucioptions.cpp: ```C++ void on_pi(const Option& o) { double x = Options["PI"]; // or double x = o; std::cerr << "received value is x = " << x << std::endl; } ... o["PI"] << Option(3.1415926, -10000000, 10000000, on_pi); ``` Then I can change the value of Pi in Stockfish via the command line, and check that Stockfish understands a floating point: ```` > ./stockfish > setoption name PI value 2.7182818284 received value is x = 2.71828 ```` On output, the default value of Pi is truncated to 3 (to remain compatible with the UCI protocol and GUIs): ```` > uci [...] option name SyzygyProbeLimit type spin default 6 min 0 max 6 option name PI type spin default 3 min -10000000 max 10000000 uciok ````
- Loading branch information
82f7d50
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thumbs down to this patch.
82f7d50
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This patch introduces the following warnings under MSVC:
\src\main.cpp(47): warning C4244: 'argument': conversion from 'double' to '::size_t', possible loss of data
\src\main.cpp(48): warning C4244: 'argument': conversion from 'double' to '::size_t', possible loss of data
\src\timeman.cpp(86): warning C4244: 'initializing': conversion from 'double' to 'TimePoint', possible loss of data
\src\timeman.cpp(87): warning C4244: 'initializing': conversion from 'double' to 'TimePoint', possible loss of data
\src\timeman.cpp(88): warning C4244: 'initializing': conversion from 'double' to 'TimePoint', possible loss of data
\src\timeman.cpp(89): warning C4244: 'initializing': conversion from 'double' to 'TimePoint', possible loss of data
\src\ucioption.cpp(40): warning C4244: 'argument': conversion from 'double' to '::size_t', possible loss of data
\src\ucioption.cpp(42): warning C4244: 'argument': conversion from 'double' to '::size_t', possible loss of data
\src\search.cpp(256): warning C4244: 'argument': conversion from 'double' to 'int', possible loss of data
\src\search.cpp(310): warning C4244: 'initializing': conversion from 'double' to '::size_t', possible loss of data
\src\search.cpp(311): warning C4244: 'argument': conversion from 'double' to 'int', possible loss of data