Add user-defined conversions to UCIOption

Greatly improves the usage. User defined conversions
are a novelity for SF, another amazing C++ facility
at work !

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
This commit is contained in:
Marco Costalba
2011-12-28 18:27:18 +01:00
parent ae65ab25d5
commit 0759d8f430
6 changed files with 44 additions and 54 deletions

View File

@@ -412,7 +412,7 @@ void read_evaluation_uci_options(Color us) {
// If running in analysis mode, make sure we use symmetrical king safety. We do this
// by replacing both Weights[kingDangerUs] and Weights[kingDangerThem] by their average.
if (Options["UCI_AnalyseMode"].value<bool>())
if (Options["UCI_AnalyseMode"])
Weights[kingDangerUs] = Weights[kingDangerThem] = (Weights[kingDangerUs] + Weights[kingDangerThem]) / 2;
init_safety();
@@ -1101,8 +1101,8 @@ namespace {
Score weight_option(const std::string& mgOpt, const std::string& egOpt, Score internalWeight) {
// Scale option value from 100 to 256
int mg = Options[mgOpt].value<int>() * 256 / 100;
int eg = Options[egOpt].value<int>() * 256 / 100;
int mg = Options[mgOpt] * 256 / 100;
int eg = Options[egOpt] * 256 / 100;
return apply_weight(make_score(mg, eg), internalWeight);
}