Move MoveParameter handling inside make/unmake_move
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
use crate::{
|
||||
board::{game::Game, history::MoveParameters},
|
||||
board::game::Game,
|
||||
evaluation::evaluation::evaluate_position,
|
||||
movegen::r#move::{Move, MoveType},
|
||||
};
|
||||
@@ -33,16 +33,15 @@ pub fn quiescence(game: &mut Game, mut alpha: i32, beta: i32) -> (Option<Move>,
|
||||
captures.sort_unstable_by_key(|mv| score_by_mvv_lva(&game.board, *mv));
|
||||
|
||||
for mv in captures {
|
||||
let move_parameters = MoveParameters::build(&game.board, &mv);
|
||||
game.board.make_move(&mv);
|
||||
|
||||
if game.board.king_under_check(color) {
|
||||
game.board.unmake_move(&move_parameters);
|
||||
game.board.unmake_move();
|
||||
continue;
|
||||
}
|
||||
|
||||
let move_score = -quiescence(game, -beta, -alpha).1;
|
||||
game.board.unmake_move(&move_parameters);
|
||||
game.board.unmake_move();
|
||||
|
||||
if move_score >= beta {
|
||||
return (Some(mv), beta);
|
||||
|
||||
Reference in New Issue
Block a user