Add minimax and adapt UCI tests

This commit is contained in:
stefiosif
2024-09-01 14:15:02 +03:00
parent e61d247411
commit ba0cbf4d7d
6 changed files with 123 additions and 58 deletions

View File

@@ -46,15 +46,24 @@ impl MoveParameters {
}
}
pub fn add_move(&mut self, mv: Move) {
pub fn build(board: &Board, mv: &Move) -> Self {
let mut move_parameters = Self::new();
move_parameters.add_move(*mv);
move_parameters.add_irreversible_parameters(board.state);
move_parameters.add_capture_and_promotion_piece(board, *mv, board.state.current_player());
move_parameters
}
fn add_move(&mut self, mv: Move) {
self.mv = Some(mv)
}
pub fn add_captured_piece(&mut self, board: &Board, dst: usize, color: Color) {
fn add_captured_piece(&mut self, board: &Board, dst: usize, color: Color) {
self.captured_piece = board.piece_type_at(dst, color);
}
pub fn add_promoted_piece(&mut self, promote: Promote) {
fn add_promoted_piece(&mut self, promote: Promote) {
self.promoted_piece = Some(promote.into_piece_type())
}