Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
UCI WDL reporting
  • Loading branch information
DanielUranga committed Aug 4, 2019
1 parent 488d7c2 commit 4013c60
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/chess/callbacks.h
Expand Up @@ -69,6 +69,10 @@ struct ThinkingInfo {
int hashfull = -1;
// Win in centipawns.
optional<int> score;
// WDL in [0-1000] range
optional<int> score_w;
optional<int> score_d;
optional<int> score_l;
// Number of successful TB probes (not the same as playouts ending in TB hit).
int tb_hits = -1;
// Best line found. Moves are from perspective of white player.
Expand Down
5 changes: 5 additions & 0 deletions src/chess/uciloop.cc
Expand Up @@ -248,6 +248,11 @@ void UciLoop::SendInfo(const std::vector<ThinkingInfo>& infos) {
if (info.time >= 0) res += " time " + std::to_string(info.time);
if (info.nodes >= 0) res += " nodes " + std::to_string(info.nodes);
if (info.score) res += " score cp " + std::to_string(*info.score);
if (info.score_w && info.score_d && info.score_l) {
res += " wdl " + std::to_string(*info.score_w) + " " +
std::to_string(*info.score_d) + " " +
std::to_string(*info.score_l);
}
if (info.hashfull >= 0) res += " hashfull " + std::to_string(info.hashfull);
if (info.nps >= 0) res += " nps " + std::to_string(info.nps);
if (info.tb_hits >= 0) res += " tbhits " + std::to_string(info.tb_hits);
Expand Down
8 changes: 8 additions & 0 deletions src/mcts/search.cc
Expand Up @@ -135,6 +135,14 @@ void Search::SendUciInfo() REQUIRES(nodes_mutex_) {
} else if (score_type == "Q") {
uci_info.score = edge.GetQ(default_q) * 10000;
}
{ // WDL
uci_info.score_d = edge.GetD() * 1000;
const float wl = 1.0f - edge.GetD();
const float w = (edge.GetQ(default_q) + 1.0f) / 2;
const float l = 1.0f - w;
uci_info.score_w = wl * w * 1000;
uci_info.score_l = wl * l * 1000;
}
if (params_.GetMultiPv() > 1) uci_info.multipv = multipv;
bool flip = played_history_.IsBlackToMove();
for (auto iter = edge; iter;
Expand Down

0 comments on commit 4013c60

Please sign in to comment.