Skip to content

Commit

Permalink
Don't post if not requested.
Browse files Browse the repository at this point in the history
Follow up fix for pull request leela-zero#2114.
  • Loading branch information
gcp committed Apr 2, 2019
1 parent 7b05537 commit cc1785c
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions src/UCTSearch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -755,15 +755,16 @@ int UCTSearch::think(int color, passflag_t passflag) {
keeprunning &= have_alternate_moves(elapsed_centis, time_for_move);
} while (keeprunning);

if (last_output == 0) {
// Make sure to post at least once.
if (cfg_analyze_interval_centis && last_output == 0) {
output_analysis(m_rootstate, *m_root);
}

// stop the search
// Stop the search.
m_run = false;
tg.wait_all();

// reactivate all pruned root children
// Reactivate all pruned root children.
for (const auto& node : m_root->get_children()) {
node->set_active(true);
}
Expand All @@ -773,7 +774,7 @@ int UCTSearch::think(int color, passflag_t passflag) {
return FastBoard::PASS;
}

// display search info
// Display search info.
myprintf("\n");
dump_stats(m_rootstate, *m_root);
Training::record(m_network, m_rootstate, *m_root);
Expand Down Expand Up @@ -824,15 +825,16 @@ void UCTSearch::ponder() {
keeprunning &= !stop_thinking(0, 1);
} while (!Utils::input_pending() && keeprunning);

if (last_output == 0) {
// Make sure to post at least once.
if (cfg_analyze_interval_centis && last_output == 0) {
output_analysis(m_rootstate, *m_root);
}

// stop the search
// Stop the search.
m_run = false;
tg.wait_all();

// display search info
// Display search info.
myprintf("\n");
dump_stats(m_rootstate, *m_root);

Expand Down

0 comments on commit cc1785c

Please sign in to comment.