pub struct Castles { /* private fields */ }
Expand description
Castling paths and unmoved rooks.
Implementations§
source§impl Castles
impl Castles
pub const fn empty(mode: CastlingMode) -> Castles
pub fn from_setup(setup: &Setup, mode: CastlingMode) -> Result<Castles, Castles>
pub const fn any(&self) -> bool
pub const fn is_empty(&self) -> bool
pub fn has(&self, color: Color, side: CastlingSide) -> bool
pub const fn has_color(&self, color: Color) -> bool
pub fn discard_rook(&mut self, square: Square)
pub fn discard_color(&mut self, color: Color)
pub const fn rook(&self, color: Color, side: CastlingSide) -> Option<Square>
sourcepub const fn path(&self, color: Color, side: CastlingSide) -> Bitboard
pub const fn path(&self, color: Color, side: CastlingSide) -> Bitboard
Gets the squares that need to be empty so that castling is possible on the given side, assuming the player still has the required castling rigths.
§Examples
use shakmaty::{Castles, CastlingSide, Bitboard, Color, Square};
let castles = Castles::default();
let path = castles.path(Color::White, CastlingSide::QueenSide);
// . . . . . . . .
// . . . . . . . .
// . . . . . . . .
// . . . . . . . .
// . . . . . . . .
// . . . . . . . .
// . . . . . . . .
// 0 1 1 1 0 . . .
assert_eq!(path, Bitboard::from(Square::B1) | Bitboard::from(Square::C1) | Bitboard::from(Square::D1));
sourcepub const fn castling_rights(&self) -> Bitboard
pub const fn castling_rights(&self) -> Bitboard
Castling rigths in terms of corresponding rook positions.
pub const fn mode(&self) -> CastlingMode
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Castles
impl RefUnwindSafe for Castles
impl Send for Castles
impl Sync for Castles
impl Unpin for Castles
impl UnwindSafe for Castles
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