diff --git a/board/src/castle.rs b/board/src/castle.rs index 17b2942..3534d8d 100644 --- a/board/src/castle.rs +++ b/board/src/castle.rs @@ -17,10 +17,12 @@ pub struct Parameters { /// Target or destination squares for the king and rook. target: Squares, - /// The set of squares that must be clear of any pieces in order to perform this castle. + /// The set of squares that must be clear of any pieces in order to perform + /// this castle. clear: BitBoard, - /// The set of squares that must not be attacked in order to perform this castle. + /// The set of squares that must not be attacked (i.e. visible to opposing + /// pieces) in order to perform this castle. check: BitBoard, } @@ -41,10 +43,14 @@ impl Parameters { self.target.rook } + /// A [`BitBoard`] of the squares that must be clear of any piece in order + /// to perform this castle move. pub fn clear_squares(&self) -> &BitBoard { &self.clear } + /// A [`BitBoard`] of the squares that must not be visible to opposing + /// pieces in order to perform this castle move. pub fn check_squares(&self) -> &BitBoard { &self.check } @@ -60,7 +66,7 @@ impl Castle { pub const ALL: [Castle; 2] = [Castle::KingSide, Castle::QueenSide]; /// Parameters for each castling move, organized by color and board-side. - const PARAMETERS: [[Parameters; 2]; 2] = [ + const PARAMETERS: [[Parameters; 2]; Color::NUM] = [ [ Parameters { origin: Squares {