Skip to content

Commit

Permalink
Report root visits in gomill-explain_last_move.
Browse files Browse the repository at this point in the history
See issue leela-zero#2280.

Pull request leela-zero#2302.
  • Loading branch information
gcp committed Apr 2, 2019
1 parent 57b7f6b commit aabfecc
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
8 changes: 3 additions & 5 deletions src/UCTSearch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -583,9 +583,7 @@ std::string UCTSearch::get_pv(FastState & state, UCTNode& parent) {
return res;
}

std::string UCTSearch::get_analysis() {
auto playouts = m_playouts.load();

std::string UCTSearch::get_analysis(int playouts) {
FastState tempstate = m_rootstate;
int color = tempstate.board.get_to_move();

Expand Down Expand Up @@ -754,7 +752,7 @@ int UCTSearch::think(int color, passflag_t passflag) {
// check if we should still search
if (!cfg_quiet && elapsed_centis - last_update > 250) {
last_update = elapsed_centis;
myprintf("%s\n", get_analysis().c_str());
myprintf("%s\n", get_analysis(m_playouts.load()).c_str());
}
keeprunning = is_running();
keeprunning &= !stop_thinking(elapsed_centis, time_for_move);
Expand Down Expand Up @@ -810,7 +808,7 @@ int UCTSearch::think(int color, passflag_t passflag) {
% m_rootstate.get_movenum()
% (color == FastBoard::BLACK ? 'B' : 'W')
% m_rootstate.move_to_text(bestmove).c_str()
% get_analysis().c_str());
% get_analysis(m_root->get_visits()).c_str());

// Copy the root state. Use to check for tree re-use in future calls.
m_last_rootstate = std::make_unique<GameState>(m_rootstate);
Expand Down
2 changes: 1 addition & 1 deletion src/UCTSearch.h
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ class UCTSearch {
void dump_stats(FastState& state, UCTNode& parent);
void tree_stats(const UCTNode& node);
std::string get_pv(FastState& state, UCTNode& parent);
std::string get_analysis();
std::string get_analysis(int playouts);
bool should_resign(passflag_t passflag, float besteval);
bool have_alternate_moves(int elapsed_centis, int time_for_move);
int est_playouts_left(int elapsed_centis, int time_for_move) const;
Expand Down

0 comments on commit aabfecc

Please sign in to comment.