Skip to content

Commit

Permalink
PhoenixGo dynamic root eval
Browse files Browse the repository at this point in the history
Merge pull request #26 from alreadydone/NN-eval-update
  • Loading branch information
alreadydone authored Jul 8, 2018
2 parents 5c464a5 + c168c12 commit f199432
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
1 change: 1 addition & 0 deletions src/UCTNode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ bool UCTNode::create_children(std::atomic<int>& nodecount,
if (state.board.white_to_move()) {
m_net_eval = 1.0f - m_net_eval;
}
update(m_net_eval);
eval = m_net_eval;

std::vector<Network::ScoreVertexPair> nodelist;
Expand Down
7 changes: 4 additions & 3 deletions src/UCTSearch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,7 @@ SearchResult UCTSearch::play_simulation(GameState & currstate,
if (currstate.get_passes() >= 2) {
auto score = currstate.final_score();
result = SearchResult::from_score(score);
node->update(result.eval());
} else if (m_nodes < MAX_TREE_SIZE) {
float eval;
const auto had_children = node->has_children();
Expand All @@ -220,12 +221,12 @@ SearchResult UCTSearch::play_simulation(GameState & currstate,
next->invalidate();
} else {
result = play_simulation(currstate, next);
if (result.valid()) {
node->update(result.eval());
}
}
}

if (result.valid()) {
node->update(result.eval());
}
node->virtual_loss_undo();

return result;
Expand Down

0 comments on commit f199432

Please sign in to comment.