fn expand(&self, position: Game) -> PositionData {
        if position.is_finished() {
            let value = value_finished_game(position);
            return PositionData::Leaf(value);
        }

        let moves = position.get_moves();
        let prediction = network::predict(position.board, moves, self.model);

        let actions = if moves.is_empty() {
            // No legal moves: `actions` just contains the pass move.
            // NOTE: dummy 0.0 prior; this is the only action so UCB doesn't matter.
            let pass_action = ActionData::new(position, Move::Pass, 0.0);
            vec![pass_action]
        } else {
            moves
                .map(|loc| ActionData::new(position, Move::Piece(loc), prediction.policy_at(loc)))
                .collect()
        };

        PositionData::Internal(InternalPosition {
            actions,
            prediction,
        })
    }
/// Expand a newly-visited position into a node.
Expand a newly-visited position into a node.
Expand a newly - visited position into a node .
fn expand(&self, position: Game) -> PositionData {
        if position.is_finished() {
            let value = value_finished_game(position);
            return PositionData::Leaf(value);
        }
        let moves = position.get_moves();
        let prediction = network::predict(position.board, moves, self.model);
        let actions = if moves.is_empty() {
            // No legal moves: `actions` just contains the pass move.
            // NOTE: dummy 0.0 prior; this is the only action so UCB doesn't matter.
            let pass_action = ActionData::new(position, Move::Pass, 0.0);
            vec![pass_action]
        } else {
            moves
                .map(|loc| ActionData::new(position, Move::Piece(loc), prediction.policy_at(loc)))
                .collect()
        };
        PositionData::Internal(InternalPosition {
            actions,
            prediction,
        })
    }
fn expand ( & self , position : Game ) -> PositionData { if position . is_finished ( ) { let value = value_finished_game ( position ) ; return PositionData :: Leaf ( value ) ; } let moves = position . get_moves ( ) ; let prediction = network :: predict ( position . board , moves , self . model ) ; let actions = if moves . is_empty ( ) { // No legal moves: `actions` just contains the pass move. // NOTE: dummy 0.0 prior; this is the only action so UCB doesn't matter. let pass_action = ActionData :: new ( position , Move :: Pass , 0.0 ) ; vec ! [ pass_action ] } else { moves . map ( | loc | ActionData :: new ( position , Move :: Piece ( loc ) , prediction . policy_at ( loc ) ) ) . collect ( ) } ; PositionData :: Internal ( InternalPosition { actions , prediction , } ) }
Expand a newly-visited position into a node.
Expand a newly - visited position into a node .
&self
position
Game
&self
position
Game