diff --git a/src/mcts/mod.rs b/src/mcts/mod.rs index ca4a0b2..d5c0a68 100644 --- a/src/mcts/mod.rs +++ b/src/mcts/mod.rs @@ -239,6 +239,8 @@ impl Searcher { let mut result = result; loop { + result = 1.0 - result; + let node = self.tree.node(node_ptr); let parent_node = node.parent_node; let parent_edge = node.parent_edge; @@ -254,7 +256,6 @@ impl Searcher { } node_ptr = parent_node; - result = 1.0 - result; } } } diff --git a/src/mcts/tree.rs b/src/mcts/tree.rs index 95de077..8b83976 100644 --- a/src/mcts/tree.rs +++ b/src/mcts/tree.rs @@ -61,11 +61,11 @@ impl Tree { let mut best_mov = ataxx::Move::NULL; let mut best_scr = 0.0; for edge in root.edges.iter() { - if edge.ptr == -1 { + if edge.visits == 0 { continue; } - let score = 1.0 - edge.q(); + let score = edge.q(); if best_mov == ataxx::Move::NULL || score > best_scr { best_mov = edge.mov;