Position

Struct Position 

Source
pub struct Position { /* private fields */ }

Implementations§

Source§

impl Position

Source

pub fn legal_moves(&self) -> MoveList

Source

pub fn legal_quiets(&self) -> MoveList

Source

pub fn legal_captures(&self) -> MoveList

Source§

impl Position

Source

pub fn new_initial() -> Self

Source

pub fn new_chess960(scharnagl_number: u32) -> Self

Source

pub fn from_fen(fen: &str) -> Result<Self, FenError>

Source

pub fn variant(&self) -> Variant

Source

pub fn hash(&self) -> u64

Source

pub fn side_to_move(&self) -> Color

Source

pub fn castling(&self, color: Color) -> Castling

Source

pub fn our_castling(&self) -> Castling

Source

pub fn en_passant(&self) -> Option<Square>

Source

pub fn pseudolegal_en_passant(&self) -> Option<Square>

Source

pub fn legal_en_passant(&self) -> Option<Square>

Source

pub fn en_passant_target(&self) -> Option<Square>

Source

pub fn halfmove_clock(&self) -> u32

Source

pub fn fullmove_number(&self) -> u32

Source

pub fn ply_number(&self) -> u32

Source

pub fn occupied(&self) -> SquareSet

Source

pub fn us(&self) -> SquareSet

Source

pub fn them(&self) -> SquareSet

Source

pub fn white(&self) -> SquareSet

Source

pub fn black(&self) -> SquareSet

Source

pub fn pawns(&self) -> SquareSet

Source

pub fn knights(&self) -> SquareSet

Source

pub fn bishops(&self) -> SquareSet

Source

pub fn rooks(&self) -> SquareSet

Source

pub fn queens(&self) -> SquareSet

Source

pub fn kings(&self) -> SquareSet

Source

pub fn colored(&self, color: Color) -> SquareSet

Source

pub fn pieces(&self, piece: Piece) -> SquareSet

Source

pub fn piece_at(&self, square: Square) -> Option<Piece>

Source

pub fn color_at(&self, square: Square) -> Option<Color>

Source

pub fn color_piece_at(&self, square: Square) -> Option<(Color, Piece)>

Source

pub fn checkers(&self) -> SquareSet

Source

pub fn pinned(&self) -> SquareSet

Source

pub fn has_non_pawn_material(&self, color: Color) -> bool

Source

pub fn has_insufficient_material(&self, color: Color) -> bool

Returns whether there is no sequence of moves for color that could result in checkmate.

Source

pub fn is_insufficient_material(&self) -> bool

Returns whether there is no sequence of moves that could result in checkmate.

Source

pub fn is_in_check(&self) -> bool

Source

pub fn our_king(&self) -> Option<Square>

Source

pub fn their_king(&self) -> Option<Square>

Source

pub fn king(&self, color: Color) -> Option<Square>

Source

pub fn attacking_with(&self, square: Square, occupied: SquareSet) -> SquareSet

Source

pub fn attacking(&self, square: Square) -> SquareSet

Source

pub fn is_pseudolegal(&self, mv: &Move) -> bool

Source

pub fn is_safe(&self, mv: &Move) -> bool

Source

pub fn is_capture(&self, mv: &Move) -> bool

Checks if a move is a capture. This function assumes that the given move is at least pseudolegal.

Source

pub fn is_quiet(&self, mv: &Move) -> bool

Source

pub fn setup(&self) -> Setup

Source

pub fn fen(&self) -> Fen

Source

pub fn skip(&mut self)

Source

pub fn play<M: ToMove>(&mut self, mv: &M) -> Result<(), M::Error>

Source

pub fn play_unchecked(&mut self, mv: &Move)

Source

pub fn validate(&self) -> Result<(), InvalidPositionError>

Trait Implementations§

Source§

impl Clone for Position

Source§

fn clone(&self) -> Position

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Position

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for Position

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl Display for Position

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl PartialEq for Position

Source§

fn eq(&self, other: &Self) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl TryFrom<Fen> for Position

Source§

type Error = InvalidPositionError

The type returned in the event of a conversion error.
Source§

fn try_from(fen: Fen) -> Result<Self, InvalidPositionError>

Performs the conversion.
Source§

impl Eq for Position

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.