Trait chess_engine::Evaluate[][src]

pub trait Evaluate: Sized {
    fn value_for(&self, color: Color) -> f64;
fn get_current_player_color(&self) -> Color;
fn get_legal_moves(&self) -> Vec<Move>;
fn apply_eval_move(&self, m: Move) -> Self; fn get_best_next_move(&self, depth: i32) -> (Move, u64, f64) { ... }
fn get_worst_next_move(&self, depth: i32) -> (Move, u64, f64) { ... }
fn minimax(
        &self,
        depth: i32,
        alpha: f64,
        beta: f64,
        is_maximizing: bool,
        getting_move_for: Color,
        board_count: &mut u64
    ) -> f64 { ... } }
Expand description

Evaluate a board and extract information, such as the best and worst moves.

Required methods

Get the value of the board for a given color. This subtracts the opponents value, and accounts for piece positions and material value.

Get the current player’s color.

Get the legal moves for the current player.

Apply a move to the board for evaluation.

Provided methods

Get the best move for the current player with depth number of moves of lookahead.

This method returns

  1. The best move
  2. The number of boards evaluated to come to a conclusion
  3. The rating of the best move

It’s best not to use the rating value by itself for anything, as it is relative to the other player’s move ratings as well.

Get the best move for the current player with depth number of moves of lookahead.

This method returns

  1. The best move
  2. The number of boards evaluated to come to a conclusion
  3. The rating of the best move

It’s best not to use the rating value by itself for anything, as it is relative to the other player’s move ratings as well.

Perform minimax on a certain position, and get the minimum or maximum value for a board. To get the best move, you minimize the values of the possible outcomes from your own position, and maximize the values of the replies made by the other player.

In other words, choose moves with the assumption that your opponent will make the best possible replies to your moves. Moves that are seemingly good, but are easily countered, are categorically eliminated by this algorithm.

Implementors