Struct myopic_board::BitBoard [−][src]
pub struct BitBoard(pub u64);
A bitboard is a value type wrapping a 64 bit integer which represents a set of squares on a chess board. Each bit is mapped to a particular square on the board, 0 -> H1, 1 -> G1,…, 8 -> H2,…, 63 -> A8. For example if we know a piece to reside on a particular square we can use a bitboard to to capture the available moves for that piece.
Implementations
impl BitBoard
[src]
impl BitBoard
[src]pub fn contains(self, square: Square) -> bool
[src]
pub fn contains(self, square: Square) -> bool
[src]Check if this bitboard contains a particular square.
pub fn is_populated(self) -> bool
[src]
pub fn is_populated(self) -> bool
[src]Check if this bitboard contains at least one square.
pub fn intersects(self, other: BitBoard) -> bool
[src]
pub fn intersects(self, other: BitBoard) -> bool
[src]Check if the intersection of this bitboard and the other is non-empty.
pub fn size(self) -> usize
[src]
pub fn size(self) -> usize
[src]Computes the number of squares in this bitboard using the popcount algorithm.
pub fn iter(self) -> impl Iterator<Item = Square>
[src]
pub fn least_set_bit(self) -> BitBoard
[src]
pub fn least_set_bit(self) -> BitBoard
[src]Returns a bitboard with the least set bit of this bitboard or nothing if this bitboard is empty.
pub fn cord(source: Square, target: Square) -> BitBoard
[src]
pub fn cord(source: Square, target: Square) -> BitBoard
[src]Computes the ‘cord’ between two squares. Imagine a queen sat on the source square on and empty board. If the queen can move to the target square then this method returns the set of squares which the queen slides along to get to this target square (inclusive of both ends) otherwise the empty bitboard is returned.
Trait Implementations
impl BitOrAssign<BitBoard> for BitBoard
[src]
impl BitOrAssign<BitBoard> for BitBoard
[src]pub fn bitor_assign(&mut self, rhs: BitBoard)
[src]
pub fn bitor_assign(&mut self, rhs: BitBoard)
[src]Performs the |=
operation. Read more
impl BitOrAssign<Square> for BitBoard
[src]
impl BitOrAssign<Square> for BitBoard
[src]pub fn bitor_assign(&mut self, rhs: Square)
[src]
pub fn bitor_assign(&mut self, rhs: Square)
[src]Performs the |=
operation. Read more
impl BitXorAssign<BitBoard> for BitBoard
[src]
impl BitXorAssign<BitBoard> for BitBoard
[src]pub fn bitxor_assign(&mut self, rhs: BitBoard)
[src]
pub fn bitxor_assign(&mut self, rhs: BitBoard)
[src]Performs the ^=
operation. Read more
impl BitXorAssign<Square> for BitBoard
[src]
impl BitXorAssign<Square> for BitBoard
[src]pub fn bitxor_assign(&mut self, rhs: Square)
[src]
pub fn bitxor_assign(&mut self, rhs: Square)
[src]Performs the ^=
operation. Read more
impl FromIterator<BitBoard> for BitBoard
[src]
impl FromIterator<BitBoard> for BitBoard
[src]We can collect an iterator of bitboards into a single bitboard under the logical OR binary operator on sets.
impl FromIterator<Square> for BitBoard
[src]
impl FromIterator<Square> for BitBoard
[src]A set of squares can be built from an iterator traversing squares.
impl IntoIterator for BitBoard
[src]
impl IntoIterator for BitBoard
[src]A bitboard is a set of squares and is therefore iterable.
impl Ord for BitBoard
[src]
impl Ord for BitBoard
[src]impl PartialOrd<BitBoard> for BitBoard
[src]
impl PartialOrd<BitBoard> for BitBoard
[src]pub fn partial_cmp(&self, other: &BitBoard) -> Option<Ordering>
[src]
pub fn partial_cmp(&self, other: &BitBoard) -> Option<Ordering>
[src]This method returns an ordering between self
and other
values if one exists. Read more
#[must_use]fn lt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]fn lt(&self, other: &Rhs) -> bool
1.0.0[src]This method tests less than (for self
and other
) and is used by the <
operator. Read more
#[must_use]fn le(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]fn le(&self, other: &Rhs) -> bool
1.0.0[src]This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
impl Shr<u8> for BitBoard
[src]
impl Shr<u8> for BitBoard
[src]Operator implementations for bitboards which all use the underlying u64 value.
impl Copy for BitBoard
[src]
impl Eq for BitBoard
[src]
impl StructuralEq for BitBoard
[src]
impl StructuralPartialEq for BitBoard
[src]
Auto Trait Implementations
impl RefUnwindSafe for BitBoard
impl Send for BitBoard
impl Sync for BitBoard
impl Unpin for BitBoard
impl UnwindSafe for BitBoard
Blanket Implementations
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]pub fn borrow_mut(&mut self) -> &mut Tⓘ
[src]
pub fn borrow_mut(&mut self) -> &mut Tⓘ
[src]Mutably borrows from an owned value. Read more
impl<T> ToOwned for T where
T: Clone,
[src]
impl<T> ToOwned for T where
T: Clone,
[src]type Owned = T
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn to_owned(&self) -> T
[src]Creates owned data from borrowed data, usually by cloning. Read more
pub fn clone_into(&self, target: &mut T)
[src]
pub fn clone_into(&self, target: &mut T)
[src]🔬 This is a nightly-only experimental API. (toowned_clone_into
)
recently added
Uses borrowed data to replace owned data, usually by cloning. Read more