pub trait RolloutPolicy {
    type G: Game;

    // Required method
    fn random_move(
        &self,
        state: &mut <Self::G as Game>::S,
        move_scratch: &mut Vec<<Self::G as Game>::M>,
        rng: &mut ThreadRng
    ) -> <Self::G as Game>::M;

    // Provided method
    fn rollout(
        &self,
        options: &MCTSOptions,
        state: &<Self::G as Game>::S
    ) -> i32
       where <Self::G as Game>::S: Clone { ... }
}
Expand description

Advanced random rollout policy for Monte Carlo Tree Search.

Required Associated Types§

source

type G: Game

The type of game that can be evaluated.

Required Methods§

source

fn random_move( &self, state: &mut <Self::G as Game>::S, move_scratch: &mut Vec<<Self::G as Game>::M>, rng: &mut ThreadRng ) -> <Self::G as Game>::M

Custom function to choose random move during rollouts. Implementations can bias towards certain moves, ensure winning moves, etc. The provided move vec is for scratch space.

Provided Methods§

source

fn rollout(&self, options: &MCTSOptions, state: &<Self::G as Game>::S) -> i32where <Self::G as Game>::S: Clone,

Implementation of a rollout over many random moves. Not needed to be overridden.

Implementors§