From d221de700d4aef599d38ed7633525da2c0686ad3 Mon Sep 17 00:00:00 2001 From: Eryn Wells Date: Sat, 13 Jul 2024 12:00:02 -0700 Subject: [PATCH] [board] Copy edit and add new documentation to Board --- board/src/board.rs | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/board/src/board.rs b/board/src/board.rs index b602237..8da5857 100644 --- a/board/src/board.rs +++ b/board/src/board.rs @@ -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()