You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
23 lines
448 B
23 lines
448 B
use chess::Piece;
|
|
|
|
pub const PAWN: f64 = 1.0;
|
|
|
|
pub const HORSEY: f64 = 3.0;
|
|
|
|
pub const BISHOP: f64 = 5.0;
|
|
|
|
pub const ROOK: f64 = 5.5;
|
|
|
|
pub const QUEEN: f64 = 10.0;
|
|
|
|
pub fn get_piece_value(piece: Option<Piece>) -> f64 {
|
|
match piece {
|
|
Some(Piece::Pawn) => PAWN,
|
|
Some(Piece::Knight) => HORSEY,
|
|
Some(Piece::Bishop) => BISHOP,
|
|
Some(Piece::Rook) => ROOK,
|
|
Some(Piece::Queen) => QUEEN,
|
|
_ => 0.0,
|
|
}
|
|
}
|