[board] Add documentation to the types in castle.rs
This commit is contained in:
parent
d9c2cfb90c
commit
e8c3d2b8db
1 changed files with 9 additions and 3 deletions
|
@ -17,10 +17,12 @@ pub struct Parameters {
|
||||||
/// Target or destination squares for the king and rook.
|
/// Target or destination squares for the king and rook.
|
||||||
target: Squares,
|
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,
|
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,
|
check: BitBoard,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -41,10 +43,14 @@ impl Parameters {
|
||||||
self.target.rook
|
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 {
|
pub fn clear_squares(&self) -> &BitBoard {
|
||||||
&self.clear
|
&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 {
|
pub fn check_squares(&self) -> &BitBoard {
|
||||||
&self.check
|
&self.check
|
||||||
}
|
}
|
||||||
|
@ -60,7 +66,7 @@ impl Castle {
|
||||||
pub const ALL: [Castle; 2] = [Castle::KingSide, Castle::QueenSide];
|
pub const ALL: [Castle; 2] = [Castle::KingSide, Castle::QueenSide];
|
||||||
|
|
||||||
/// Parameters for each castling move, organized by color and board-side.
|
/// Parameters for each castling move, organized by color and board-side.
|
||||||
const PARAMETERS: [[Parameters; 2]; 2] = [
|
const PARAMETERS: [[Parameters; 2]; Color::NUM] = [
|
||||||
[
|
[
|
||||||
Parameters {
|
Parameters {
|
||||||
origin: Squares {
|
origin: Squares {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue