From 2d5710ccb10c80f61cc3240c99e7e965dfafde04 Mon Sep 17 00:00:00 2001 From: Eryn Wells Date: Sun, 28 Jan 2024 15:58:36 -0800 Subject: [PATCH] Clean up Pawn::pushes a little bit --- position/src/move_generator/pawn.rs | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/position/src/move_generator/pawn.rs b/position/src/move_generator/pawn.rs index 401366e..1797603 100644 --- a/position/src/move_generator/pawn.rs +++ b/position/src/move_generator/pawn.rs @@ -30,13 +30,11 @@ impl PawnMoveGenerator { let square = piece.square(); let bitboard: BitBoard = square.into(); - let empty_squares = position.empty_squares(); + let starting_rank = Rank::PAWN_STARTING_RANKS[piece.color() as usize]; + let empty_squares = position.empty_squares(); let mut moves = bitboard.shift_north_one() & empty_squares; - if !(bitboard - & BitBoard::rank(Rank::PAWN_STARTING_RANKS[piece.color() as usize].as_index())) - .is_empty() - { + if !(bitboard & BitBoard::rank(starting_rank.as_index())).is_empty() { moves |= moves.shift_north_one() & empty_squares; }