fn backprop(&mut self, mut idx: usize, winner: Option<G::Player>) {
        let winner = winner.unwrap_or_else(|| self[self.root].state.player());

        // Backpropagate until the root
        let null = self[self.root].parent;
        while idx != null {
            let node = &mut self[idx];

            // Update statistics of node
            // NOTE: The game state stores the next player, but in MCTS, each
            //       node represents the current player.
            if winner != node.state.player() {
                node.wins += 1;
            }
            node.sims += 1;

            // Ascend to parent
            idx = node.parent;
        }
    }
/// Backpropagate the result of a simulation.
Backpropagate the result of a simulation.
Backpropagate the result of a simulation .
fn backprop(&mut self, mut idx: usize, winner: Option<G::Player>) {
        let winner = winner.unwrap_or_else(|| self[self.root].state.player());
        // Backpropagate until the root
        let null = self[self.root].parent;
        while idx != null {
            let node = &mut self[idx];
            // Update statistics of node
            // NOTE: The game state stores the next player, but in MCTS, each
            //       node represents the current player.
            if winner != node.state.player() {
                node.wins += 1;
            }
            node.sims += 1;
            // Ascend to parent
            idx = node.parent;
        }
    }
fn backprop ( & mut self , mut idx : usize , winner : Option < G :: Player > ) { let winner = winner . unwrap_or_else ( | | self [ self . root ] . state . player ( ) ) ; // Backpropagate until the root let null = self [ self . root ] . parent ; while idx != null { let node = & mut self [ idx ] ; // Update statistics of node // NOTE: The game state stores the next player, but in MCTS, each //       node represents the current player. if winner != node . state . player ( ) { node . wins += 1 ; } node . sims += 1 ; // Ascend to parent idx = node . parent ; } }
Backpropagate the result of a simulation.
Backpropagate the result of a simulation .
&mut self
idx
usize
winner
Option<G::Player>
&mut self
idx
usize
winner
Option<G::Player>