pub trait Strategy<G: Game> {
    // Required method
    fn choose_move(&mut self, state: &G::S) -> Option<G::M>;

    // Provided methods
    fn set_timeout(&mut self, _timeout: Duration) { ... }
    fn set_max_depth(&mut self, _depth: u8) { ... }
    fn principal_variation(&self) -> Vec<G::M> { ... }
}
Expand description

Defines a method of choosing a move for the current player.

Required Methods§

source

fn choose_move(&mut self, state: &G::S) -> Option<G::M>

Provided Methods§

source

fn set_timeout(&mut self, _timeout: Duration)

For strategies that can ponder indefinitely, set the timeout. This can be changed between calls to choose_move.

source

fn set_max_depth(&mut self, _depth: u8)

Set the maximum depth to evaluate (instead of the timeout). This can be changed between calls to choose_move.

source

fn principal_variation(&self) -> Vec<G::M>

From the last choose_move call, return the principal variation, i.e. the best sequence of moves for both players.

Implementors§

source§

impl<E> Strategy<<E as Evaluator>::G> for ParallelSearch<E>where <E::G as Game>::S: Clone + Send + Sync, <E::G as Game>::M: Copy + Eq + Send + Sync, E: Clone + Sync + Send + 'static + Evaluator,

source§

impl<E: Evaluator> Strategy<<E as Evaluator>::G> for IterativeSearch<E>where <E::G as Game>::S: Clone, <E::G as Game>::M: Copy + Eq,

source§

impl<E: Evaluator> Strategy<<E as Evaluator>::G> for Negamax<E>where <E::G as Game>::S: Clone, <E::G as Game>::M: Copy,

source§

impl<G> Strategy<G> for MonteCarloTreeSearch<G>where G: Sync + Game, G::S: Clone + Send, G::M: Copy + Sync,

source§

impl<G: Game> Strategy<G> for Random<G>where G::M: Copy,