Struct State

Source
pub struct State {
    pub turn: Color,
    pub move_buff: Vec<MoveBuffItem>,
    /* private fields */
}
Expand description

State records the state of a chess game

Fields§

§turn: Color§move_buff: Vec<MoveBuffItem>

Implementations§

Source§

impl State

State implementation

Source

pub fn parse_piece_placement(&mut self, fen: &str)

parses piece placement

Source

pub fn new() -> State

creates a new empty State

Source

pub fn set_from_fen(&mut self, fen: &str)

sets state from fen

Source

pub fn put(&mut self, sq: Square, p: Piece)

Source

pub fn remove(&mut self, sq: Square)

Source

pub fn init(&mut self, variant: Variant)

initializes state to variant

Source

pub fn piece_at_square(&self, sq: Square) -> Piece

returns the piece at a square

Source

pub fn report_fen(&self) -> String

reports the state as fen

Source

pub fn print_bitboards(&self)

prints bitboards

Source

pub fn color_figure_mobility_at_square( &self, sq: Square, gen_mode: MoveGenMode, col: Color, fig: Figure, ) -> Bitboard

returns mobility of color figure at square

generates pseudo legal moves for turn

generates pseudo legal moves for color

Source

pub fn pretty_print_string(&mut self) -> String

returns the state as pretty printable string

Source

pub fn gen_move_buff(&mut self) -> String

generates moves with meta information

Source

pub fn init_variant(&self)

initialize from variant

Source

pub fn variant_start_fen(&self) -> &str

returns the start fen for the variant of the state

Source

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

makes a move

Trait Implementations§

Source§

impl Clone for State

Source§

fn clone(&self) -> State

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

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

Performs copy-assignment from source. Read more

Auto Trait Implementations§

§

impl Freeze for State

§

impl RefUnwindSafe for State

§

impl Send for State

§

impl Sync for State

§

impl Unpin for State

§

impl UnwindSafe for State

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, 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.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V