pub fn step(&mut self) {
        // Select a leaf of the current MCTS tree by UCB.
        let (leaf, trajectory, previously_visited) = self.select_leaf();

        // Expand the leaf (unless it's a game-ending state we already visited).
        if !previously_visited {
            let expanded = self.expand(leaf);
            self.positions.insert(leaf, expanded);
        }
        let leaf_data = self.positions.get(&leaf).unwrap();

        // Compute the value of the position for the Black player.
        let black_value = if leaf.active_player == Player::Black {
            leaf_data.value()
        } else {
            -1.0 * leaf_data.value()
        };

        // Update the statistics up this trajectory for both players.
        self.update_statistics(trajectory, black_value);
    }
/// Advance the MCTS tree by a single "simulation".
Advance the MCTS tree by a single "simulation".
Advance the MCTS tree by a single " simulation " .
pub fn step(&mut self) {
        // Select a leaf of the current MCTS tree by UCB.
        let (leaf, trajectory, previously_visited) = self.select_leaf();
        // Expand the leaf (unless it's a game-ending state we already visited).
        if !previously_visited {
            let expanded = self.expand(leaf);
            self.positions.insert(leaf, expanded);
        }
        let leaf_data = self.positions.get(&leaf).unwrap();
        // Compute the value of the position for the Black player.
        let black_value = if leaf.active_player == Player::Black {
            leaf_data.value()
        } else {
            -1.0 * leaf_data.value()
        };
        // Update the statistics up this trajectory for both players.
        self.update_statistics(trajectory, black_value);
    }
pub fn step ( & mut self ) { // Select a leaf of the current MCTS tree by UCB. let ( leaf , trajectory , previously_visited ) = self . select_leaf ( ) ; // Expand the leaf (unless it's a game-ending state we already visited). if ! previously_visited { let expanded = self . expand ( leaf ) ; self . positions . insert ( leaf , expanded ) ; } let leaf_data = self . positions . get ( & leaf ) . unwrap ( ) ; // Compute the value of the position for the Black player. let black_value = if leaf . active_player == Player :: Black { leaf_data . value ( ) } else { - 1.0 * leaf_data . value ( ) } ; // Update the statistics up this trajectory for both players. self . update_statistics ( trajectory , black_value ) ; }
Advance the MCTS tree by a single "simulation".
Advance the MCTS tree by a single " simulation " .
&mut self
&mut self