pub struct Position { /* private fields */ }Implementations§
Source§impl Position
impl Position
pub fn new() -> Self
pub fn empty() -> Self
Sourcepub fn side_to_move(&self) -> Color
pub fn side_to_move(&self) -> Color
Returns the current side to move’s color
Sourcepub fn pieces_bb(&self, color: Color) -> Bitboard
pub fn pieces_bb(&self, color: Color) -> Bitboard
Returns the bitboard of all pieces of a given color
Sourcepub fn pieces_bb_type(&self, pt: PieceType) -> Bitboard
pub fn pieces_bb_type(&self, pt: PieceType) -> Bitboard
Returns the bitboard of all pieces of a given piece type
Sourcepub fn pieces_bb_color(&self, color: Color, pt: PieceType) -> Bitboard
pub fn pieces_bb_color(&self, color: Color, pt: PieceType) -> Bitboard
Returns the bitboard of all pieces of a given color and piece type
Sourcepub fn piece_at(&self, square: Square) -> Piece
pub fn piece_at(&self, square: Square) -> Piece
Returns the piece at a given square, Piece::NONE if the square is empty
Sourcepub fn castling_rights(&self) -> CastlingRights
pub fn castling_rights(&self) -> CastlingRights
Returns the castling rights
Sourcepub fn ep_square(&self) -> Square
pub fn ep_square(&self) -> Square
Returns the en passant square, or Square::NONE if there is none
pub fn set_castling_rights(&mut self, rights: CastlingRights)
Sourcepub fn set_ep_square_unchecked(&mut self, sq: Square)
pub fn set_ep_square_unchecked(&mut self, sq: Square)
No validation is done, use with caution
pub fn add_castling_rights(&mut self, rights: CastlingRights)
pub fn set_side_to_move(&mut self, side: Color)
pub fn set_ply(&mut self, ply: u16)
pub fn ply(&self) -> u16
pub fn set_rule50_counter(&mut self, counter: u16)
pub fn rule50_counter(&self) -> u16
Sourcepub fn fen(&self) -> Result<String, PositionError>
pub fn fen(&self) -> Result<String, PositionError>
Returns the FEN representation of the position
Sourcepub fn from_fen(fen: &str) -> Result<Self, PositionError>
pub fn from_fen(fen: &str) -> Result<Self, PositionError>
Create a position from a FEN string
Sourcepub fn is_attacked(&self, sq: Square, c: Color) -> bool
pub fn is_attacked(&self, sq: Square, c: Color) -> bool
Check if a square is attacked by the given color
Sourcepub fn is_checked(&self, c: Color) -> bool
pub fn is_checked(&self, c: Color) -> bool
Returns true if the given color is in check
pub fn after_move(&self, mv: Move) -> Self
Trait Implementations§
impl Copy for Position
impl Eq for Position
impl StructuralPartialEq for Position
Auto Trait Implementations§
impl Freeze for Position
impl RefUnwindSafe for Position
impl Send for Position
impl Sync for Position
impl Unpin for Position
impl UnwindSafe for Position
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