[board] Copy edit and add new documentation to Board

This commit is contained in:
Eryn Wells 2024-07-13 12:00:02 -07:00
parent c297e4cbfa
commit d221de700d

View file

@ -90,10 +90,12 @@ impl Board {
&self.flags
}
/// Returns `true` if the player has the right to castle on the given side of the board.
/// Returns `true` if the player has the right to castle on the given side
/// of the board.
///
/// The right to castle on a particular side of the board is retained as long as the player has
/// not moved their king, or the rook on that side of the board.
/// A player retains the right to castle on a particular side of the board
/// as long as they have not moved their king, or the rook on that side of
/// the board.
#[must_use]
pub fn player_has_right_to_castle(&self, color: Color, castle: Castle) -> bool {
self.flags.player_has_right_to_castle(color, castle)
@ -106,7 +108,8 @@ impl Board {
self.piece_on_square(square)
}
/// A [`BitBoard`] representing the set of squares containing a piece.
/// A [`BitBoard`] representing the set of squares containing a piece. This
/// set is the inverse of [`Board::empty_squares`].
#[must_use]
pub fn occupied_squares(&self) -> &BitBoard {
self.pieces.all_pieces()
@ -127,8 +130,8 @@ impl Board {
(self.friendly_pieces(), self.opposing_pieces())
}
/// A [`BitBoard`] representing the set of squares containing a piece. This set is the inverse of
/// `Board::occupied_squares`.
/// A [BitBoard] representing the set of squares containing a piece. This
/// set is the inverse of [`Board::occupied_squares`].
#[must_use]
pub fn empty_squares(&self) -> BitBoard {
!self.occupied_squares()