Skip to content

Commit

Permalink
Return a clean root node on resignation.
Browse files Browse the repository at this point in the history
We rely on m_root not being null, so if there is no good tree to take
a move from, make a clean new root.

Fixes issue leela-zero#680.
  • Loading branch information
gcp committed Jan 19, 2018
1 parent e9171bc commit 47ddf38
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/UCTNode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -418,9 +418,9 @@ UCTNode::node_ptr_t UCTNode::find_new_root(const int move) {
}
}
}
// Should never fail to find the child.
assert(false);
return nullptr;
// Can happen for example if we resigned. Return a clean
// root for the next game or position.
return std::make_unique<UCTNode>(FastBoard::PASS, 0.0f, 0.5f);
}

// Use this version if the child could be anywhere.
Expand Down

0 comments on commit 47ddf38

Please sign in to comment.