RetroBoard

Struct RetroBoard 

Source
pub struct RetroBoard { /* private fields */ }
Expand description

A shakmaty::Board where Unmove are played and all legal Unmove can be generated. It is the user responsability to ensure that position is legal. Unreachable positions are considered legal, for example this position.

Implementations§

Source§

impl RetroBoard

Source

pub fn new_no_pockets(fen: &str) -> Result<Self, ParseFenError>

Returns a new RetroBoard with empty RetroPocket for both colors.

Source

pub fn new( fen: &str, pocket_white: &str, pocket_black: &str, ) -> Result<Self, ParseFenError>

Returns a new RetroBoard with defined RetroPocket, see RetroPocket::from_str documentation to see which string format is expected.

§Examples
use retroboard::RetroBoard;
let r = RetroBoard::new("3k4/8/8/8/8/8/8/2RKR3 w - - 0 1", "PNQ1", "7BBBB").unwrap();
Source

pub fn push(&mut self, m: &UnMove)

Source

pub fn legal_unmoves(&self) -> UnMoveList

Generate legal unmoves, which are all the pseudo legal unmoves which do not put the opponent’s king in check. If the opponent’s king is in check at the beginning of our turn, the only legal unmoves are those which stop it from being in check.

Source

pub fn board(&self) -> &Board

Source

pub fn retro_turn(&self) -> Color

Source

pub fn us(&self) -> Bitboard

Source

pub fn our(&self, role: Role) -> Bitboard

Source

pub fn them(&self) -> Bitboard

Source

pub fn their(&self, role: Role) -> Bitboard

Source

pub fn king_of(&self, color: Color) -> Square

Source

pub fn flip_vertical(&mut self)

Source

pub fn flip_horizontal(&mut self)

Source

pub fn flip_diagonal(&mut self)

Source

pub fn flip_anti_diagonal(&mut self)

Source

pub fn rotate_90(&mut self)

Source

pub fn rotate_180(&mut self)

Source

pub fn rotate_270(&mut self)

Trait Implementations§

Source§

impl Clone for RetroBoard

Source§

fn clone(&self) -> RetroBoard

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 RetroBoard

Source§

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

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

impl Display for RetroBoard

Source§

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

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

impl From<Chess> for RetroBoard

Source§

fn from(chess: Chess) -> Self

RetroBoard::halfmoves is set to 0, and RetroPocket will be empty for both colors

Source§

impl From<RetroBoard> for Chess

Source§

fn from(rboard: RetroBoard) -> Self

Consider valid positions with too many/impossible checkers (unreachable positions) Chess::halfmoves and Chess::fullmoves are respectively set to 0 and 1

Source§

impl From<RetroBoard> for Setup

Source§

fn from(rboard: RetroBoard) -> Self

Setup::halfmoves and Setup::fullmoves are respectively set to 0 and 1 Setup::castling_rights is empty

Source§

impl FromSetup for RetroBoard

Source§

fn from_setup( setup: Setup, _: CastlingMode, ) -> Result<Self, PositionError<Self>>

RetroPocket will be empty for both colors

§Warning

No legality check is done, and the behaviour of RetroBoard is undefined for illegal positions

Source§

impl Hash for RetroBoard

Source§

fn hash<H: Hasher>(&self, state: &mut H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for RetroBoard

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 Eq for RetroBoard

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.