fn expand(&mut self, idx: usize) {
        // Iterate through actions to create children
        for action in self[idx].state.turns() {
            // Clone state and play action
            let mut state: G = *self[idx].state.clone();
            state.play(action.clone());

            // Add the new child
            self.arena.push(Node::new(
                self.arena.len(),
                idx,
                Box::new(state),
                Some(action),
            ));
            // Parent stores index of child
            let child = self.arena.last().unwrap().idx;
            self[idx].children.push(child);
        }
    }
/// Expand a node to create children in the game tree.
Expand a node to create children in the game tree.
Expand a node to create children in the game tree .
fn expand(&mut self, idx: usize) {
        // Iterate through actions to create children
        for action in self[idx].state.turns() {
            // Clone state and play action
            let mut state: G = *self[idx].state.clone();
            state.play(action.clone());
            // Add the new child
            self.arena.push(Node::new(
                self.arena.len(),
                idx,
                Box::new(state),
                Some(action),
            ));
            // Parent stores index of child
            let child = self.arena.last().unwrap().idx;
            self[idx].children.push(child);
        }
    }
fn expand ( & mut self , idx : usize ) { // Iterate through actions to create children for action in self [ idx ] . state . turns ( ) { // Clone state and play action let mut state : G = * self [ idx ] . state . clone ( ) ; state . play ( action . clone ( ) ) ; // Add the new child self . arena . push ( Node :: new ( self . arena . len ( ) , idx , Box :: new ( state ) , Some ( action ) , ) ) ; // Parent stores index of child let child = self . arena . last ( ) . unwrap ( ) . idx ; self [ idx ] . children . push ( child ) ; } }
Expand a node to create children in the game tree.
Expand a node to create children in the game tree .
&mut self
idx
usize
&mut self
idx
usize