Struct shakmaty::bitboard::Bitboard [−][src]
pub struct Bitboard(pub u64);
A set of squares represented by a 64 bit integer mask.
Examples
let mask = Bitboard::from(Rank::Third).with(Square::E5); // . . . . . . . . // . . . . . . . . // . . . . . . . . // . . . . 1 . . . // . . . . . . . . // 1 1 1 1 1 1 1 1 // . . . . . . . . // . . . . . . . . assert_eq!(mask.first(), Some(Square::A3));
Methods
impl Bitboard
[src]
impl Bitboard
pub fn from_square(sq: Square) -> Bitboard
[src]
pub fn from_square(sq: Square) -> Bitboard
A bitboard with a single square.
pub fn rank(rank: Rank) -> Bitboard
[src]
pub fn rank(rank: Rank) -> Bitboard
Returns the bitboard containing all squares of the given rank.
pub fn file(file: File) -> Bitboard
[src]
pub fn file(file: File) -> Bitboard
Returns the bitboard containing all squares of the given file.
pub fn relative_rank(color: Color, rank: Rank) -> Bitboard
[src]
pub fn relative_rank(color: Color, rank: Rank) -> Bitboard
Like rank()
, but from the point of view of color
.
pub fn relative_shift(self, color: Color, shift: u32) -> Bitboard
[src]
pub fn relative_shift(self, color: Color, shift: u32) -> Bitboard
Shift using <<
for White
and >>
for Black
.
pub fn any(self) -> bool
[src]
pub fn any(self) -> bool
pub fn is_empty(self) -> bool
[src]
pub fn is_empty(self) -> bool
pub fn contains(self, sq: Square) -> bool
[src]
pub fn contains(self, sq: Square) -> bool
pub fn add<T: Into<Bitboard>>(&mut self, squares: T)
[src]
pub fn add<T: Into<Bitboard>>(&mut self, squares: T)
pub fn flip<T: Into<Bitboard>>(&mut self, squares: T)
[src]
pub fn flip<T: Into<Bitboard>>(&mut self, squares: T)
pub fn discard<T: Into<Bitboard>>(&mut self, squares: T)
[src]
pub fn discard<T: Into<Bitboard>>(&mut self, squares: T)
pub fn remove(&mut self, sq: Square) -> bool
[src]
pub fn remove(&mut self, sq: Square) -> bool
pub fn set(&mut self, sq: Square, v: bool)
[src]
pub fn set(&mut self, sq: Square, v: bool)
pub fn clear(&mut self)
[src]
pub fn clear(&mut self)
pub fn with<T: Into<Bitboard>>(self, squares: T) -> Bitboard
[src]
pub fn with<T: Into<Bitboard>>(self, squares: T) -> Bitboard
pub fn without<T: Into<Bitboard>>(self, squares: T) -> Bitboard
[src]
pub fn without<T: Into<Bitboard>>(self, squares: T) -> Bitboard
pub fn is_disjoint<T: Into<Bitboard>>(self, other: T) -> bool
[src]
pub fn is_disjoint<T: Into<Bitboard>>(self, other: T) -> bool
pub fn is_subset<T: Into<Bitboard>>(self, other: T) -> bool
[src]
pub fn is_subset<T: Into<Bitboard>>(self, other: T) -> bool
pub fn is_superset<T: Into<Bitboard>>(self, other: T) -> bool
[src]
pub fn is_superset<T: Into<Bitboard>>(self, other: T) -> bool
pub fn pop_front(&mut self) -> Option<Square>
[src]
pub fn pop_front(&mut self) -> Option<Square>
pub fn first(self) -> Option<Square>
[src]
pub fn first(self) -> Option<Square>
pub fn pop_back(&mut self) -> Option<Square>
[src]
pub fn pop_back(&mut self) -> Option<Square>
pub fn last(self) -> Option<Square>
[src]
pub fn last(self) -> Option<Square>
pub fn count(self) -> usize
[src]
pub fn count(self) -> usize
pub fn more_than_one(self) -> bool
[src]
pub fn more_than_one(self) -> bool
pub fn single_square(self) -> Option<Square>
[src]
pub fn single_square(self) -> Option<Square>
ⓘImportant traits for CarryRipplerpub fn carry_rippler(self) -> CarryRippler
[src]
pub fn carry_rippler(self) -> CarryRippler
An iterator over the subsets of this bitboard.
pub const EMPTY: Bitboard
EMPTY: Bitboard = Bitboard(0)
An empty bitboard.
pub const ALL: Bitboard
ALL: Bitboard = Bitboard(!0u64)
A bitboard containing all squares.
pub const DARK_SQUARES: Bitboard
DARK_SQUARES: Bitboard = Bitboard(12273903644374837845)
All dark squares.
pub const LIGHT_SQUARES: Bitboard
LIGHT_SQUARES: Bitboard = Bitboard(6172840429334713770)
All light squares.
pub const CORNERS: Bitboard
CORNERS: Bitboard = Bitboard(9295429630892703873)
The four corner squares.
pub const BACKRANKS: Bitboard
BACKRANKS: Bitboard = Bitboard(18374686479671623935)
The backranks.
pub const CENTER: Bitboard
CENTER: Bitboard = Bitboard(103481868288)
The four center squares.
Trait Implementations
impl Copy for Bitboard
[src]
impl Copy for Bitboard
impl Clone for Bitboard
[src]
impl Clone for Bitboard
fn clone(&self) -> Bitboard
[src]
fn clone(&self) -> Bitboard
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
impl Eq for Bitboard
[src]
impl Eq for Bitboard
impl PartialEq for Bitboard
[src]
impl PartialEq for Bitboard
fn eq(&self, other: &Bitboard) -> bool
[src]
fn eq(&self, other: &Bitboard) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, other: &Bitboard) -> bool
[src]
fn ne(&self, other: &Bitboard) -> bool
This method tests for !=
.
impl Ord for Bitboard
[src]
impl Ord for Bitboard
fn cmp(&self, other: &Bitboard) -> Ordering
[src]
fn cmp(&self, other: &Bitboard) -> Ordering
This method returns an Ordering
between self
and other
. Read more
fn max(self, other: Self) -> Self
1.21.0[src]
fn max(self, other: Self) -> Self
Compares and returns the maximum of two values. Read more
fn min(self, other: Self) -> Self
1.21.0[src]
fn min(self, other: Self) -> Self
Compares and returns the minimum of two values. Read more
impl PartialOrd for Bitboard
[src]
impl PartialOrd for Bitboard
fn partial_cmp(&self, other: &Bitboard) -> Option<Ordering>
[src]
fn partial_cmp(&self, other: &Bitboard) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
fn lt(&self, other: &Bitboard) -> bool
[src]
fn lt(&self, other: &Bitboard) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
fn le(&self, other: &Bitboard) -> bool
[src]
fn le(&self, other: &Bitboard) -> bool
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
fn gt(&self, other: &Bitboard) -> bool
[src]
fn gt(&self, other: &Bitboard) -> bool
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
fn ge(&self, other: &Bitboard) -> bool
[src]
fn ge(&self, other: &Bitboard) -> bool
This method tests greater than or equal to (for self
and other
) and is used by the >=
operator. Read more
impl Hash for Bitboard
[src]
impl Hash for Bitboard
fn hash<__H: Hasher>(&self, state: &mut __H)
[src]
fn hash<__H: Hasher>(&self, state: &mut __H)
Feeds this value into the given [Hasher
]. Read more
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
Feeds a slice of this type into the given [Hasher
]. Read more
impl Default for Bitboard
[src]
impl Default for Bitboard
impl Debug for Bitboard
[src]
impl Debug for Bitboard
fn fmt(&self, f: &mut Formatter) -> Result
[src]
fn fmt(&self, f: &mut Formatter) -> Result
Formats the value using the given formatter. Read more
impl UpperHex for Bitboard
[src]
impl UpperHex for Bitboard
impl LowerHex for Bitboard
[src]
impl LowerHex for Bitboard
impl Octal for Bitboard
[src]
impl Octal for Bitboard
impl Binary for Bitboard
[src]
impl Binary for Bitboard
impl From<Square> for Bitboard
[src]
impl From<Square> for Bitboard
impl From<Rank> for Bitboard
[src]
impl From<Rank> for Bitboard
impl From<File> for Bitboard
[src]
impl From<File> for Bitboard
impl From<u64> for Bitboard
[src]
impl From<u64> for Bitboard
impl From<Bitboard> for u64
[src]
impl From<Bitboard> for u64
impl<T> BitAnd<T> for Bitboard where
T: Into<Bitboard>,
[src]
impl<T> BitAnd<T> for Bitboard where
T: Into<Bitboard>,
type Output = Bitboard
The resulting type after applying the &
operator.
fn bitand(self, rhs: T) -> Bitboard
[src]
fn bitand(self, rhs: T) -> Bitboard
Performs the &
operation.
impl<T> BitAndAssign<T> for Bitboard where
T: Into<Bitboard>,
[src]
impl<T> BitAndAssign<T> for Bitboard where
T: Into<Bitboard>,
fn bitand_assign(&mut self, rhs: T)
[src]
fn bitand_assign(&mut self, rhs: T)
Performs the &=
operation.
impl<T> BitOr<T> for Bitboard where
T: Into<Bitboard>,
[src]
impl<T> BitOr<T> for Bitboard where
T: Into<Bitboard>,
type Output = Bitboard
The resulting type after applying the |
operator.
fn bitor(self, rhs: T) -> Bitboard
[src]
fn bitor(self, rhs: T) -> Bitboard
Performs the |
operation.
impl<T> BitOrAssign<T> for Bitboard where
T: Into<Bitboard>,
[src]
impl<T> BitOrAssign<T> for Bitboard where
T: Into<Bitboard>,
fn bitor_assign(&mut self, rhs: T)
[src]
fn bitor_assign(&mut self, rhs: T)
Performs the |=
operation.
impl<T> BitXor<T> for Bitboard where
T: Into<Bitboard>,
[src]
impl<T> BitXor<T> for Bitboard where
T: Into<Bitboard>,
type Output = Bitboard
The resulting type after applying the ^
operator.
fn bitxor(self, rhs: T) -> Bitboard
[src]
fn bitxor(self, rhs: T) -> Bitboard
Performs the ^
operation.
impl<T> BitXorAssign<T> for Bitboard where
T: Into<Bitboard>,
[src]
impl<T> BitXorAssign<T> for Bitboard where
T: Into<Bitboard>,
fn bitxor_assign(&mut self, rhs: T)
[src]
fn bitxor_assign(&mut self, rhs: T)
Performs the ^=
operation.
impl Not for Bitboard
[src]
impl Not for Bitboard
type Output = Bitboard
The resulting type after applying the !
operator.
fn not(self) -> Bitboard
[src]
fn not(self) -> Bitboard
Performs the unary !
operation.
impl FromIterator<Square> for Bitboard
[src]
impl FromIterator<Square> for Bitboard
fn from_iter<T>(iter: T) -> Self where
T: IntoIterator<Item = Square>,
[src]
fn from_iter<T>(iter: T) -> Self where
T: IntoIterator<Item = Square>,
Creates a value from an iterator. Read more
impl Extend<Square> for Bitboard
[src]
impl Extend<Square> for Bitboard
fn extend<T: IntoIterator<Item = Square>>(&mut self, iter: T)
[src]
fn extend<T: IntoIterator<Item = Square>>(&mut self, iter: T)
Extends a collection with the contents of an iterator. Read more
impl IntoIterator for Bitboard
[src]
impl IntoIterator for Bitboard