mirror of
https://github.com/opelly27/Stockfish.git
synced 2026-05-20 07:27:46 +00:00
Consistent use of anonymous namespace
Also change `bindThisThread` to match the current code style for function naming. closes https://github.com/official-stockfish/Stockfish/pull/5118 No functional change
This commit is contained in:
+33
-27
@@ -30,10 +30,39 @@ using std::string;
|
||||
|
||||
namespace Stockfish {
|
||||
|
||||
bool Tune::update_on_last;
|
||||
const Option* LastOption = nullptr;
|
||||
OptionsMap* Tune::options;
|
||||
static std::map<std::string, int> TuneResults;
|
||||
bool Tune::update_on_last;
|
||||
const Option* LastOption = nullptr;
|
||||
OptionsMap* Tune::options;
|
||||
|
||||
|
||||
namespace {
|
||||
std::map<std::string, int> TuneResults;
|
||||
|
||||
void on_tune(const Option& o) {
|
||||
|
||||
if (!Tune::update_on_last || LastOption == &o)
|
||||
Tune::read_options();
|
||||
}
|
||||
|
||||
|
||||
void make_option(OptionsMap* options, const string& n, int v, const SetRange& r) {
|
||||
|
||||
// Do not generate option when there is nothing to tune (ie. min = max)
|
||||
if (r(v).first == r(v).second)
|
||||
return;
|
||||
|
||||
if (TuneResults.count(n))
|
||||
v = TuneResults[n];
|
||||
|
||||
(*options)[n] << Option(v, r(v).first, r(v).second, on_tune);
|
||||
LastOption = &((*options)[n]);
|
||||
|
||||
// Print formatted parameters, ready to be copy-pasted in Fishtest
|
||||
std::cout << n << "," << v << "," << r(v).first << "," << r(v).second << ","
|
||||
<< (r(v).second - r(v).first) / 20.0 << ","
|
||||
<< "0.0020" << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
string Tune::next(string& names, bool pop) {
|
||||
|
||||
@@ -54,29 +83,6 @@ string Tune::next(string& names, bool pop) {
|
||||
return name;
|
||||
}
|
||||
|
||||
static void on_tune(const Option& o) {
|
||||
|
||||
if (!Tune::update_on_last || LastOption == &o)
|
||||
Tune::read_options();
|
||||
}
|
||||
|
||||
static void make_option(OptionsMap* options, const string& n, int v, const SetRange& r) {
|
||||
|
||||
// Do not generate option when there is nothing to tune (ie. min = max)
|
||||
if (r(v).first == r(v).second)
|
||||
return;
|
||||
|
||||
if (TuneResults.count(n))
|
||||
v = TuneResults[n];
|
||||
|
||||
(*options)[n] << Option(v, r(v).first, r(v).second, on_tune);
|
||||
LastOption = &((*options)[n]);
|
||||
|
||||
// Print formatted parameters, ready to be copy-pasted in Fishtest
|
||||
std::cout << n << "," << v << "," << r(v).first << "," << r(v).second << ","
|
||||
<< (r(v).second - r(v).first) / 20.0 << ","
|
||||
<< "0.0020" << std::endl;
|
||||
}
|
||||
|
||||
template<>
|
||||
void Tune::Entry<int>::init_option() {
|
||||
|
||||
Reference in New Issue
Block a user