fn move_to_best_child<R : Rng + ?Sized>(&mut self, game_tree : &mut GameTree, rng : &mut R) {
        let current_node_index = self.current_node_index();

        let (num_edges, children_start_index, normalized_distance_distribution) = {
            let current_node = &game_tree.nodes[current_node_index];

            let current_game_end_distance_distribution = current_node.game_end_distance_distribution;
            //Has to be non-degenerate by construction, since it's a parent node
            let nondegenerate = current_game_end_distance_distribution.coerce_to_nondegenerate().unwrap();
            let single_observation = nondegenerate.as_single_observation();
            let normalized_distance_distribution = NormalInverseChiSquared::NonDegenerate(single_observation);

            let expanded_edges = &current_node.maybe_expanded_edges.as_ref().unwrap();
            let edges = &expanded_edges.edges;

            let num_edges = edges.len();
            let children_start_index = expanded_edges.children_start_index;

            (num_edges, children_start_index, normalized_distance_distribution)
        };

        let mut min_index = 0;
        let mut min_value = f64::INFINITY;

        for i in 0..num_edges {
            let child_index = children_start_index + i;
            let child = &game_tree.nodes[child_index];

            let child_game_end_distance_distribution = child.game_end_distance_distribution;
            let combined_game_end_distance_distribution = child_game_end_distance_distribution.merge(&normalized_distance_distribution);

            let sampled_distance = combined_game_end_distance_distribution.sample(rng);
            if (sampled_distance < min_value) {
                min_value = sampled_distance;
                min_index = i;
            }
        }

        let current_node = &mut game_tree.nodes[current_node_index];
        let edges = &mut current_node.maybe_expanded_edges.as_mut().unwrap().edges;
        
        edges[min_index].visit_count += 1;
        let added_matrix = edges[min_index].added_matrix.clone();

        let best_node_index = children_start_index + min_index;
        self.index_stack.push(best_node_index); 
        self.game_state = self.game_state.clone().add_matrix(added_matrix);
    }
///Assumes that the children have already been expanded
Assumes that the children have already been expanded
Assumes that the children have already been expanded
fn move_to_best_child<R : Rng + ?Sized>(&mut self, game_tree : &mut GameTree, rng : &mut R) {
        let current_node_index = self.current_node_index();
        let (num_edges, children_start_index, normalized_distance_distribution) = {
            let current_node = &game_tree.nodes[current_node_index];
            let current_game_end_distance_distribution = current_node.game_end_distance_distribution;
            //Has to be non-degenerate by construction, since it's a parent node
            let nondegenerate = current_game_end_distance_distribution.coerce_to_nondegenerate().unwrap();
            let single_observation = nondegenerate.as_single_observation();
            let normalized_distance_distribution = NormalInverseChiSquared::NonDegenerate(single_observation);
            let expanded_edges = &current_node.maybe_expanded_edges.as_ref().unwrap();
            let edges = &expanded_edges.edges;
            let num_edges = edges.len();
            let children_start_index = expanded_edges.children_start_index;
            (num_edges, children_start_index, normalized_distance_distribution)
        };
        let mut min_index = 0;
        let mut min_value = f64::INFINITY;
        for i in 0..num_edges {
            let child_index = children_start_index + i;
            let child = &game_tree.nodes[child_index];
            let child_game_end_distance_distribution = child.game_end_distance_distribution;
            let combined_game_end_distance_distribution = child_game_end_distance_distribution.merge(&normalized_distance_distribution);
            let sampled_distance = combined_game_end_distance_distribution.sample(rng);
            if (sampled_distance < min_value) {
                min_value = sampled_distance;
                min_index = i;
            }
        }
        let current_node = &mut game_tree.nodes[current_node_index];
        let edges = &mut current_node.maybe_expanded_edges.as_mut().unwrap().edges;
        edges[min_index].visit_count += 1;
        let added_matrix = edges[min_index].added_matrix.clone();
        let best_node_index = children_start_index + min_index;
        self.index_stack.push(best_node_index); 
        self.game_state = self.game_state.clone().add_matrix(added_matrix);
    }
fn move_to_best_child < R : Rng + ? Sized > ( & mut self , game_tree : & mut GameTree , rng : & mut R ) { let current_node_index = self . current_node_index ( ) ; let ( num_edges , children_start_index , normalized_distance_distribution ) = { let current_node = & game_tree . nodes [ current_node_index ] ; let current_game_end_distance_distribution = current_node . game_end_distance_distribution ; //Has to be non-degenerate by construction, since it's a parent node let nondegenerate = current_game_end_distance_distribution . coerce_to_nondegenerate ( ) . unwrap ( ) ; let single_observation = nondegenerate . as_single_observation ( ) ; let normalized_distance_distribution = NormalInverseChiSquared :: NonDegenerate ( single_observation ) ; let expanded_edges = & current_node . maybe_expanded_edges . as_ref ( ) . unwrap ( ) ; let edges = & expanded_edges . edges ; let num_edges = edges . len ( ) ; let children_start_index = expanded_edges . children_start_index ; ( num_edges , children_start_index , normalized_distance_distribution ) } ; let mut min_index = 0 ; let mut min_value = f64 :: INFINITY ; for i in 0 .. num_edges { let child_index = children_start_index + i ; let child = & game_tree . nodes [ child_index ] ; let child_game_end_distance_distribution = child . game_end_distance_distribution ; let combined_game_end_distance_distribution = child_game_end_distance_distribution . merge ( & normalized_distance_distribution ) ; let sampled_distance = combined_game_end_distance_distribution . sample ( rng ) ; if ( sampled_distance < min_value ) { min_value = sampled_distance ; min_index = i ; } } let current_node = & mut game_tree . nodes [ current_node_index ] ; let edges = & mut current_node . maybe_expanded_edges . as_mut ( ) . unwrap ( ) . edges ; edges [ min_index ] . visit_count += 1 ; let added_matrix = edges [ min_index ] . added_matrix . clone ( ) ; let best_node_index = children_start_index + min_index ; self . index_stack . push ( best_node_index ) ; self . game_state = self . game_state . clone ( ) . add_matrix ( added_matrix ) ; }
Assumes that the children have already been expanded
Assumes that the children have already been expanded
&mut self
game_tree
&mut GameTree
rng
&mut R
&mut self
game_tree
&mut GameTree
rng
&mut R