Square

Enum Square 

Source
#[repr(u8)]
pub enum Square {
Show 64 variants A1 = 0, B1 = 1, C1 = 2, D1 = 3, E1 = 4, F1 = 5, G1 = 6, H1 = 7, A2 = 8, B2 = 9, C2 = 10, D2 = 11, E2 = 12, F2 = 13, G2 = 14, H2 = 15, A3 = 16, B3 = 17, C3 = 18, D3 = 19, E3 = 20, F3 = 21, G3 = 22, H3 = 23, A4 = 24, B4 = 25, C4 = 26, D4 = 27, E4 = 28, F4 = 29, G4 = 30, H4 = 31, A5 = 32, B5 = 33, C5 = 34, D5 = 35, E5 = 36, F5 = 37, G5 = 38, H5 = 39, A6 = 40, B6 = 41, C6 = 42, D6 = 43, E6 = 44, F6 = 45, G6 = 46, H6 = 47, A7 = 48, B7 = 49, C7 = 50, D7 = 51, E7 = 52, F7 = 53, G7 = 54, H7 = 55, A8 = 56, B8 = 57, C8 = 58, D8 = 59, E8 = 60, F8 = 61, G8 = 62, H8 = 63,
}

Variants§

§

A1 = 0

§

B1 = 1

§

C1 = 2

§

D1 = 3

§

E1 = 4

§

F1 = 5

§

G1 = 6

§

H1 = 7

§

A2 = 8

§

B2 = 9

§

C2 = 10

§

D2 = 11

§

E2 = 12

§

F2 = 13

§

G2 = 14

§

H2 = 15

§

A3 = 16

§

B3 = 17

§

C3 = 18

§

D3 = 19

§

E3 = 20

§

F3 = 21

§

G3 = 22

§

H3 = 23

§

A4 = 24

§

B4 = 25

§

C4 = 26

§

D4 = 27

§

E4 = 28

§

F4 = 29

§

G4 = 30

§

H4 = 31

§

A5 = 32

§

B5 = 33

§

C5 = 34

§

D5 = 35

§

E5 = 36

§

F5 = 37

§

G5 = 38

§

H5 = 39

§

A6 = 40

§

B6 = 41

§

C6 = 42

§

D6 = 43

§

E6 = 44

§

F6 = 45

§

G6 = 46

§

H6 = 47

§

A7 = 48

§

B7 = 49

§

C7 = 50

§

D7 = 51

§

E7 = 52

§

F7 = 53

§

G7 = 54

§

H7 = 55

§

A8 = 56

§

B8 = 57

§

C8 = 58

§

D8 = 59

§

E8 = 60

§

F8 = 61

§

G8 = 62

§

H8 = 63

Implementations§

Source§

impl Square

Source

pub const fn to_int(self) -> u8

Source

pub const fn to_index(self) -> usize

Source

pub const fn from_int(int: u8) -> Self

Source

pub const fn from_index(index: usize) -> Self

Source

pub const fn from_rank_and_file(rank: Rank, file: File) -> Self

Source

pub const fn get_rank(self) -> Rank

Source

pub fn get_rank_bb(self) -> BitBoard

Source

pub const fn get_file(self) -> File

Source

pub fn get_file_bb(self) -> BitBoard

Source

pub fn up(self) -> Option<Square>

Source

pub fn down(self) -> Option<Square>

Source

pub fn left(self) -> Option<Square>

Source

pub fn right(self) -> Option<Square>

Source

pub fn up_left(self) -> Option<Square>

Source

pub fn up_right(self) -> Option<Square>

Source

pub fn down_left(self) -> Option<Square>

Source

pub fn down_right(self) -> Option<Square>

Source

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

Source

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

Source

pub fn wrapping_up(self) -> Square

Source

pub fn wrapping_down(self) -> Square

Source

pub fn wrapping_left(self) -> Square

Source

pub fn wrapping_right(self) -> Square

Source

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

Source

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

Source

pub fn to_bitboard(self) -> BitBoard

Source

pub fn distance(self, other: Square) -> u8

Source

pub const fn manhattan_distance(self, other: Square) -> u8

Source

pub fn knight_distance(self, other: Square) -> u8

Source

pub fn vertical_mirror(self) -> Self

Source

pub fn horizontal_mirror(self) -> Self

Source

pub fn rotate(self) -> Self

Source

pub fn line(self, other: Square) -> BitBoard

Get a line (extending to infinity, which in chess is 8 squares), given two squares. This line does extend past the squares.

Source

pub fn between(self, other: Square) -> BitBoard

Get a line between these two squares, not including the squares themselves.

Source

pub fn get_diagonal_bishop_rays_bb(self) -> BitBoard

Get the rays for a bishop on a particular square.

Source

pub fn get_anti_diagonal_bishop_rays_bb(self) -> BitBoard

Get the rays for a bishop on a particular square.

Source

pub fn get_bishop_rays_bb(self) -> BitBoard

Get the rays for a bishop on a particular square.

Source

pub fn get_rook_rays_bb(self) -> BitBoard

Get the rays for a rook on a particular square.

Source

pub fn get_all_direction_rays_bb(self) -> BitBoard

Get the rays for a rook and bishop together on a particular square.

Source

pub fn get_king_moves(self) -> BitBoard

Get the king moves for a particular square.

Source

pub fn get_knight_moves(self) -> BitBoard

Get the knight moves for a particular square.

Source

pub fn get_pawn_attacks(self, color: Color, blockers: BitBoard) -> BitBoard

Get the pawn capture move for a particular square, given the pawn’s color and the potential victims

Source

pub fn get_pawn_quiets(self, color: Color, blockers: BitBoard) -> BitBoard

Get the quiet pawn moves (non-captures) for a particular square, given the pawn’s color and the potential blocking pieces.

Source

pub fn get_pawn_moves(self, color: Color, blockers: BitBoard) -> BitBoard

Get all the pawn moves for a particular square, given the pawn’s color and the potential blocking pieces and victims.

Trait Implementations§

Source§

impl Clone for Square

Source§

fn clone(&self) -> Square

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 Compress for Square

Source§

impl Debug for Square

Source§

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

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

impl Decompress<Square> for u16

Source§

impl<'de> Deserialize<'de> for Square

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Display for Square

Source§

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

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

impl<'source> FromPyObject<'source> for Square

Source§

fn extract_bound(ob: &Bound<'source, PyAny>) -> PyResult<Self>

Extracts Self from the bound smart pointer obj. Read more
Source§

impl FromStr for Square

Source§

type Err = TimecatError

The associated error which can be returned from parsing.
Source§

fn from_str(s: &str) -> Result<Self>

Parses a string s to return a value of this type. Read more
Source§

impl Hash for Square

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 Index<Square> for ChessPositionBuilder

Source§

type Output = Option<Piece>

The returned type after indexing.
Source§

fn index(&self, index: Square) -> &Self::Output

Performs the indexing (container[index]) operation. Read more
Source§

impl IndexMut<Square> for ChessPositionBuilder

Source§

fn index_mut(&mut self, index: Square) -> &mut Self::Output

Performs the mutable indexing (container[index]) operation. Read more
Source§

impl PartialEq for Square

Source§

fn eq(&self, other: &Square) -> 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 Serialize for Square

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl Copy for Square

Source§

impl Eq for Square

Source§

impl StructuralPartialEq for Square

Auto Trait Implementations§

§

impl Freeze for Square

§

impl RefUnwindSafe for Square

§

impl Send for Square

§

impl Sync for Square

§

impl Unpin for Square

§

impl UnwindSafe for Square

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> CustomColorize for T
where T: ToString,

Source§

fn colorize( &self, style_functions: &[fn(ColoredString) -> ColoredString], ) -> String

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<'py, T> FromPyObjectBound<'_, 'py> for T
where T: FromPyObject<'py>,

Source§

fn from_py_object_bound(ob: Borrowed<'_, 'py, PyAny>) -> Result<T, PyErr>

Extracts Self from the bound smart pointer obj. Read more
Source§

impl<T> FromQuery for T

Source§

type Target = T

Target type after parsing.
Source§

type Error = HistoryError

Error that can occur while parsing.
Source§

fn from_query( query: &str, ) -> Result<<T as FromQuery>::Target, <T as FromQuery>::Error>

Decode this query string into the target type.
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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
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> ToQuery for T
where T: Serialize,

Source§

type Error = HistoryError

Error that can be returned from the conversion.
Source§

fn to_query(&self) -> Result<Cow<'_, str>, <T as ToQuery>::Error>

Method to encode the query into a string.
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.
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> Ungil for T
where T: Send,