pub struct Castles { /* private fields */ }
Expand description
Castling paths and unmoved rooks.
Implementations
sourceimpl Castles
impl Castles
pub fn empty(mode: CastlingMode) -> Castles
pub fn from_setup(setup: &Setup, mode: CastlingMode) -> Result<Castles, Castles>
pub fn any(&self) -> bool
pub fn is_empty(&self) -> bool
pub fn has(&self, color: Color, side: CastlingSide) -> bool
pub fn has_side(&self, color: Color) -> bool
👎Deprecated:
renamed to Castles::has_color()
pub fn has_color(&self, color: Color) -> bool
pub fn discard_rook(&mut self, square: Square)
pub fn discard_side(&mut self, color: Color)
👎Deprecated:
renamed to Castles::discard_color()
pub fn discard_color(&mut self, color: Color)
pub fn rook(&self, color: Color, side: CastlingSide) -> Option<Square>
sourcepub fn path(&self, color: Color, side: CastlingSide) -> Bitboard
pub 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 fn castling_rights(&self) -> Bitboard
pub fn castling_rights(&self) -> Bitboard
Castling rigths in terms of corresponding rook positions.
pub fn mode(&self) -> CastlingMode
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for Castles
impl Send for Castles
impl Sync for Castles
impl Unpin for Castles
impl UnwindSafe for Castles
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more