diff --git a/position/src/position/position.rs b/position/src/position/position.rs index ab5a71a..01de793 100644 --- a/position/src/position/position.rs +++ b/position/src/position/position.rs @@ -212,12 +212,15 @@ impl Position { self.moves().moves_for_piece(piece) } + #[cfg(test)] pub(crate) fn sight_of_piece(&self, piece: &PlacedPiece) -> BitBoard { piece.sight(&self.pieces, self.en_passant_square) } /// A bitboard representing the squares where a king of the given color will - /// be in danger. The king cannot move to these squares. + /// be in danger of being captured by the opposing player. If the king is on + /// one of these squares, it is in check. The king cannot move to these + /// squares. pub(crate) fn king_danger(&self, color: Color) -> BitBoard { let pieces_without_king = { let mut cloned_pieces = self.pieces.clone(); @@ -230,6 +233,7 @@ impl Position { self._sight_of_player(color.other(), &pieces_without_king) } + #[cfg(test)] pub(crate) fn is_king_in_check(&self) -> bool { let danger_squares = self.king_danger(self.color_to_move); !(danger_squares & self.king_bitboard(self.color_to_move)).is_empty()