pub struct Board { /* private fields */ }Expand description
Validated location of pieces on the board.
A board is structurally valid when:
- the Black and White squares are disjoint;
- the six role bitboards are pairwise disjoint;
- the union of the player bitboards equals the union of the role bitboards; and
occupiedis that shared union.
This does not imply that the board is a legal chess position.
Implementations§
Source§impl Board
Board Move API.
impl Board
Board Move API.
Sourcepub const fn attacks_on(
self,
square: Square,
attacker: Player,
occupied: Bitboard,
) -> Bitboard
pub const fn attacks_on( self, square: Square, attacker: Player, occupied: Bitboard, ) -> Bitboard
Pieces of attacker on this board that attack square.
occupied is the occupancy view used for line-of-sight and for
filtering attackers. This supports king-safety checks after the other
player moves: removed pieces are ignored, and slider rays use the
post-move blockers.
This is not a full hypothetical-board query for moves by attacker,
because piece roles and players still come from self.
pub const fn attacked_en_passant( self, en_passant: EnPassant, turn: Player, ) -> Option<EnPassant>
pub const fn effective_en_passant( self, en_passant: Option<EnPassant>, turn: Player, ) -> Option<EnPassant>
pub fn king_shields(self, player: Player) -> Bitboard
Source§impl Board
Board Chess API.
impl Board
Board Chess API.
pub const fn bishops(self) -> Bitboard
pub const fn bishops_and_queens(self) -> Bitboard
pub const fn black(self) -> Bitboard
pub const fn king_of(self, player: Player) -> Option<Square>
pub const fn kings(self) -> Bitboard
pub const fn knights(self) -> Bitboard
pub const fn occupied(self) -> Bitboard
pub const fn pawns(self) -> Bitboard
pub const fn player(self, player: Player) -> Bitboard
pub const fn player_at(self, square: Square) -> Option<Player>
pub const fn queens(self) -> Bitboard
pub const fn role(self, role: Role) -> Bitboard
pub const fn role_at(self, square: Square) -> Option<Role>
pub const fn rooks(self) -> Bitboard
pub const fn rooks_and_queens(self) -> Bitboard
pub const fn unique_king_of(self, player: Player) -> Option<Square>
pub const fn white(self) -> Bitboard
Trait Implementations§
impl Copy for Board
impl Eq for Board
Source§impl Ord for Board
impl Ord for Board
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl PartialOrd for Board
impl PartialOrd for Board
impl StructuralPartialEq for Board
Auto Trait Implementations§
impl Freeze for Board
impl RefUnwindSafe for Board
impl Send for Board
impl Sync for Board
impl Unpin for Board
impl UnsafeUnpin for Board
impl UnwindSafe for Board
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more