#[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
impl Square
pub const fn to_int(self) -> u8
pub const fn to_index(self) -> usize
pub const fn from_int(int: u8) -> Self
pub const fn from_index(index: usize) -> Self
pub const fn from_rank_and_file(rank: Rank, file: File) -> Self
pub const fn get_rank(self) -> Rank
pub fn get_rank_bb(self) -> BitBoard ⓘ
pub const fn get_file(self) -> File
pub fn get_file_bb(self) -> BitBoard ⓘ
pub fn up(self) -> Option<Square>
pub fn down(self) -> Option<Square>
pub fn left(self) -> Option<Square>
pub fn right(self) -> Option<Square>
pub fn up_left(self) -> Option<Square>
pub fn up_right(self) -> Option<Square>
pub fn down_left(self) -> Option<Square>
pub fn down_right(self) -> Option<Square>
pub fn forward(self, color: Color) -> Option<Square>
pub fn backward(self, color: Color) -> Option<Square>
pub fn wrapping_up(self) -> Square
pub fn wrapping_down(self) -> Square
pub fn wrapping_left(self) -> Square
pub fn wrapping_right(self) -> Square
pub fn wrapping_forward(self, color: Color) -> Square
pub fn wrapping_backward(self, color: Color) -> Square
pub fn to_bitboard(self) -> BitBoard ⓘ
pub fn distance(self, other: Square) -> u8
pub const fn manhattan_distance(self, other: Square) -> u8
pub fn knight_distance(self, other: Square) -> u8
pub fn vertical_mirror(self) -> Self
pub fn horizontal_mirror(self) -> Self
pub fn rotate(self) -> Self
Sourcepub fn line(self, other: Square) -> BitBoard ⓘ
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.
Sourcepub fn between(self, other: Square) -> BitBoard ⓘ
pub fn between(self, other: Square) -> BitBoard ⓘ
Get a line between these two squares, not including the squares themselves.
Sourcepub fn get_diagonal_bishop_rays_bb(self) -> BitBoard ⓘ
pub fn get_diagonal_bishop_rays_bb(self) -> BitBoard ⓘ
Get the rays for a bishop on a particular square.
Sourcepub fn get_anti_diagonal_bishop_rays_bb(self) -> BitBoard ⓘ
pub fn get_anti_diagonal_bishop_rays_bb(self) -> BitBoard ⓘ
Get the rays for a bishop on a particular square.
Sourcepub fn get_bishop_rays_bb(self) -> BitBoard ⓘ
pub fn get_bishop_rays_bb(self) -> BitBoard ⓘ
Get the rays for a bishop on a particular square.
Sourcepub fn get_rook_rays_bb(self) -> BitBoard ⓘ
pub fn get_rook_rays_bb(self) -> BitBoard ⓘ
Get the rays for a rook on a particular square.
Sourcepub fn get_all_direction_rays_bb(self) -> BitBoard ⓘ
pub fn get_all_direction_rays_bb(self) -> BitBoard ⓘ
Get the rays for a rook and bishop together on a particular square.
Sourcepub fn get_king_moves(self) -> BitBoard ⓘ
pub fn get_king_moves(self) -> BitBoard ⓘ
Get the king moves for a particular square.
Sourcepub fn get_knight_moves(self) -> BitBoard ⓘ
pub fn get_knight_moves(self) -> BitBoard ⓘ
Get the knight moves for a particular square.
Sourcepub fn get_pawn_attacks(self, color: Color, blockers: BitBoard) -> BitBoard ⓘ
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
Trait Implementations§
Source§impl Compress for Square
impl Compress for Square
type CompressedItem = u16
fn compress(self) -> Self::CompressedItem
Source§impl Decompress<Square> for u16
impl Decompress<Square> for u16
fn decompress(self) -> Square
Source§impl<'de> Deserialize<'de> for Square
impl<'de> Deserialize<'de> for Square
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
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<'source> FromPyObject<'source> for Square
impl<'source> FromPyObject<'source> for Square
Source§impl Index<Square> for ChessPositionBuilder
impl Index<Square> for ChessPositionBuilder
Source§impl IndexMut<Square> for ChessPositionBuilder
impl IndexMut<Square> for ChessPositionBuilder
impl Copy for Square
impl Eq for Square
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> 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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> CustomColorize for Twhere
T: ToString,
impl<T> CustomColorize for Twhere
T: ToString,
fn colorize( &self, style_functions: &[fn(ColoredString) -> ColoredString], ) -> String
Source§impl<'py, T> FromPyObjectBound<'_, 'py> for Twhere
T: FromPyObject<'py>,
impl<'py, T> FromPyObjectBound<'_, 'py> for Twhere
T: FromPyObject<'py>,
Source§impl<T> FromQuery for Twhere
T: DeserializeOwned,
impl<T> FromQuery for Twhere
T: DeserializeOwned,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
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