From 1c4ff99e428ded7e57e7abad51cb54e9e94c45e8 Mon Sep 17 00:00:00 2001 From: Tilps Date: Wed, 9 May 2018 09:54:07 +1000 Subject: [PATCH] Apply an upper bound to visits during search The existing limit on nodes is not sufficient to avoid integer overflow of visit count, if search starts visiting terminal states, as terminal state visits never result in new children being added. --- src/UCTSearch.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/UCTSearch.cpp b/src/UCTSearch.cpp index 5e5a8816b..cca9d1370 100644 --- a/src/UCTSearch.cpp +++ b/src/UCTSearch.cpp @@ -280,7 +280,7 @@ void UCTSearch::dump_analysis(int64_t elapsed, bool force_output) { } bool UCTSearch::is_running() const { - return m_run && m_nodes < MAX_TREE_SIZE; + return m_run && m_nodes < MAX_TREE_SIZE && m_root->get_visits() < MAXINT_DIV2; } int UCTSearch::est_playouts_left() const {