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.
21 lines
703 B
21 lines
703 B
use chess::{Board, ChessMove, Color, MoveGen, Piece};
|
|
|
|
pub fn eval_board(board: Board, playing_as: Color, curr_depth: u8) -> i128 {
|
|
let mut current_eval: i128 = 0;
|
|
|
|
let moves_iter = MoveGen::new_legal(&board).into_iter();
|
|
|
|
moves_iter.for_each(|mov| {
|
|
let tmp_board = board.make_move_new(mov);
|
|
current_eval += tmp_board.color_combined(playing_as).count() as i128;
|
|
current_eval -= tmp_board.color_combined(!playing_as).count() as i128;
|
|
eprintln!("{}", current_eval);
|
|
if curr_depth != 0 {
|
|
eprintln!("{}", curr_depth);
|
|
current_eval += eval_board(tmp_board, playing_as, curr_depth - 1)
|
|
}
|
|
});
|
|
|
|
return current_eval;
|
|
}
|