Skip to content

Commit

Permalink
Cleanup uci settings & clamp wdl percentages
Browse files Browse the repository at this point in the history
Bench: 2134743
  • Loading branch information
SzilBalazs committed Aug 15, 2023
1 parent 19ff4d0 commit 459e058
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 7 deletions.
5 changes: 4 additions & 1 deletion src/search/wdl_model.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@ namespace search::wdl_model {
loss_chance += loss_polynomial[i];
}

return {std::round(win_chance * 1000), std::round(loss_chance * 1000)};
int w = std::round(win_chance * 1000);
int l = std::round(loss_chance * 1000);

return {std::clamp(w, 0, 1000), std::clamp(l, 0, 1000)};
}
} // namespace search::wdl_model
9 changes: 6 additions & 3 deletions src/uci/option.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,7 @@ namespace uci {

void set_value(const std::optional<std::string> &new_value) {
value = new_value.value_or(default_value);
if (func) {
func.value()();
}
update();
}

template<typename T>
Expand All @@ -72,6 +70,11 @@ namespace uci {
return value;
}

void update() {
if (func) {
func.value()();
}
}

private:
std::string name;
Expand Down
7 changes: 4 additions & 3 deletions src/uci/uci.h
Original file line number Diff line number Diff line change
Expand Up @@ -166,20 +166,21 @@ namespace uci {
sm.allocate_hash(get_option<int>("Hash"));
},
1, 65536);
sm.allocate_hash(32);

options.emplace_back(
"Threads", "1", "spin", [&]() {
sm.allocate_threads(get_option<int>("Threads"));
},
1, 128);
sm.allocate_threads(1);

options.emplace_back(
"UCI_ShowWDL", "false", "check", [&]() {
search::report::set_show_wdl(get_option<bool>("UCI_ShowWDL"));
});
search::report::set_show_wdl(false);

for (Option &opt : options) {
opt.update();
}
}

void UCI::start() {
Expand Down

0 comments on commit 459e058

Please sign in to comment.