From 1bbe33f3aa50ebd50f45a521645a19d294e2c00a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Varga=20D=C3=A1vid=20Lajos?= Date: Thu, 20 Nov 2025 20:28:16 +0100 Subject: [PATCH] added method get_pseudo_bishop_moves_ignore_king in bitboard::attacks for king safety checks --- engine/src/bitboard/attacks.rs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/engine/src/bitboard/attacks.rs b/engine/src/bitboard/attacks.rs index 27c54e0..cd547d4 100644 --- a/engine/src/bitboard/attacks.rs +++ b/engine/src/bitboard/attacks.rs @@ -72,6 +72,21 @@ impl Board { return self.get_pseudo_bishop_moves(sq) | self.get_pseudo_rook_moves(sq); } + #[inline] + pub fn get_pseudo_bishop_moves_ignore_king(&self, sq: u32) -> u64 { + let mut moves = 0u64; + let sq = sq as usize; + let king = self.bitboards[5 + 6*self.side_to_move as usize]; + let occupancy = self.occupancy[2] & !king; + moves |= get_raycast_from_square_in_direction(occupancy, sq, 1); + moves |= get_raycast_from_square_in_direction(occupancy, sq, 3); + moves |= get_raycast_from_square_in_direction(occupancy, sq, 5); + moves |= get_raycast_from_square_in_direction(occupancy, sq, 7); + + return moves; + } + + #[inline] pub fn is_square_attacked(&self, king_sq: u32) -> bool { let offset: usize = 6 * self.side_to_move as usize;