Improve readability and remove redundant code

This commit is contained in:
stefiosif
2024-09-06 20:07:10 +03:00
parent 2081ddac56
commit 6b9650a6f0
7 changed files with 65 additions and 59 deletions

View File

@@ -22,7 +22,7 @@ pub fn negamax(
let (mut best_move, mut best_score, mate_score) = (None, MIN_SCORE, -MATE_SCORE + plies as i32);
let mut legal_moves = 0;
for mv in game.board.pseudo_moves_all(color) {
for mv in game.board.pseudo_moves_all() {
let move_parameters = MoveParameters::build(&game.board, &mv);
game.board.make_move(&mv);

View File

@@ -7,7 +7,7 @@ pub fn driver(game: &mut Game, nodes: &mut u64, depth: u8) {
}
let color = game.current_player();
let pseudo_moves = game.board.pseudo_moves_all(color);
let pseudo_moves = game.board.pseudo_moves_all();
for mv in pseudo_moves {
let original_board = game.board.clone();

View File

@@ -18,7 +18,7 @@ pub fn quiescence(game: &mut Game, mut alpha: i32, beta: i32) -> (Option<Move>,
let captures = game
.board
.pseudo_moves_all(color)
.pseudo_moves_all()
.into_iter()
.filter(|m| !matches!(m.move_type, MoveType::Quiet));