added method get_pseudo_bishop_moves_ignore_king in bitboard::attacks for king safety checks
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user