diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/board/mod.rs | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/src/board/mod.rs b/src/board/mod.rs index 3f37d62..2bb1147 100644 --- a/src/board/mod.rs +++ b/src/board/mod.rs @@ -794,13 +794,8 @@ impl Board { fn is_square_attacked(&self, square: Square, attacker_color: Color) -> bool { for (piece_type, piece) in self.pieces_by_color(attacker_color).iter().enumerate() { match PieceType::from(piece_type) { - PieceType::Pawn => { - if self.attacks.pawn[attacker_color.flip() as usize][square as usize] & piece > 0 { - return true - } - } - PieceType::King => { - if self.attacks.king[square as usize] & piece > 0 { + PieceType::Queen => { + if self.attacks.queen(self.occupancy, square) & piece > 0 { return true } } @@ -819,8 +814,13 @@ impl Board { return true } } - PieceType::Queen => { - if self.attacks.queen(self.occupancy, square) & piece > 0 { + PieceType::Pawn => { + if self.attacks.pawn[attacker_color.flip() as usize][square as usize] & piece > 0 { + return true + } + } + PieceType::King => { + if self.attacks.king[square as usize] & piece > 0 { return true } } |