pub trait Evaluator {
    type G: Game;

    // Required method
    fn evaluate(&self, s: &<Self::G as Game>::S) -> Evaluation;

    // Provided method
    fn generate_noisy_moves(
        &self,
        _state: &<Self::G as Game>::S,
        _moves: &mut Vec<<Self::G as Game>::M>
    ) { ... }
}
Expand description

Evaluates a game’s positions.

Required Associated Types§

source

type G: Game

The type of game that can be evaluated.

Required Methods§

source

fn evaluate(&self, s: &<Self::G as Game>::S) -> Evaluation

Evaluate the non-terminal state from the persective of the player to move next.

Provided Methods§

source

fn generate_noisy_moves( &self, _state: &<Self::G as Game>::S, _moves: &mut Vec<<Self::G as Game>::M> )

Optional interface to support strategies using quiescence search.

A “noisy” move is a threatening move that requires a response.

The term comes from chess, where capturing a piece is considered a noisy move. Capturing a piece is often the first move out of an exchange of captures. Evaluating the board state after only the first capture can give a misleadingly high score. The solution is to continue the search among only noisy moves and find the score once the board state settles.

Noisy moves are not inherent parts of the rules, but engine decisions, so they are implemented in Evaluator instead of Game.

Implementors§