[−][src]Trait chess_engine::Evaluate
Evaluate a board and extract information, such as the best and worst moves.
Required methods
fn value_for(&self, color: Color) -> f64[src]
Get the value of the board for a given color. This subtracts the opponents value, and accounts for piece positions and material value.
fn get_current_player_color(&self) -> Color[src]
Get the current player's color.
fn get_legal_moves(&self) -> Vec<Move>[src]
Get the legal moves for the current player.
fn apply_eval_move(&self, m: Move) -> Self[src]
Apply a move to the board for evaluation.
Provided methods
fn get_best_next_move(&self, depth: i32) -> (Move, u64, f64)[src]
Get the best move for the current player with depth number of moves
of lookahead.
This method returns
- The best move
- The number of boards evaluated to come to a conclusion
- 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.
fn get_worst_next_move(&self, depth: i32) -> (Move, u64, f64)[src]
Get the best move for the current player with depth number of moves
of lookahead.
This method returns
- The best move
- The number of boards evaluated to come to a conclusion
- 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.
fn minimax(
&self,
depth: i32,
mut alpha: f64,
mut beta: f64,
is_maximizing: bool,
getting_move_for: Color,
board_count: &mut u64
) -> f64[src]
&self,
depth: i32,
mut alpha: f64,
mut beta: f64,
is_maximizing: bool,
getting_move_for: Color,
board_count: &mut u64
) -> f64
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.