[−][src]Struct myopic_core::BitBoard
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]
pub fn contains(self, square: Square) -> bool
[src]
Check if this bitboard contains a particular square.
pub fn subsumes(self, other: BitBoard) -> bool
[src]
Check if this set is a superset of the other.
pub fn is_empty(self) -> bool
[src]
Check if this bitboard is empty, i.e contains no squares.
pub fn is_populated(self) -> bool
[src]
Check if this bitboard contains at least one square.
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]
Computes the number of squares in this bitboard using the popcount algorithm.
pub fn iter(self) -> impl Iterator<Item = Square>
[src]
pub fn first(self) -> Option<Square>
[src]
Finds the first square in this set if it is non-empty.
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]
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.
pub const EMPTY: BitBoard
[src]
The empty bitboard (set of no squares).
pub const ALL: BitBoard
[src]
The complete bitboard (set of all squares).
pub const RANKS: [BitBoard; 8]
[src]
Array of bitboards represented the eight ranks, ordered 1 to 8.
pub const FILES: [BitBoard; 8]
[src]
Array of bitboards represented the eight files, ordered H to A.
Trait Implementations
impl BitAnd<BitBoard> for BitBoard
[src]
type Output = Self
The resulting type after applying the &
operator.
pub fn bitand(self, other: BitBoard) -> Self
[src]
impl BitAnd<BitBoard> for Square
[src]
type Output = BitBoard
The resulting type after applying the &
operator.
pub fn bitand(self, other: BitBoard) -> Self::Output
[src]
impl BitAnd<Square> for BitBoard
[src]
type Output = Self
The resulting type after applying the &
operator.
pub fn bitand(self, other: Square) -> Self
[src]
impl BitOr<BitBoard> for BitBoard
[src]
type Output = Self
The resulting type after applying the |
operator.
pub fn bitor(self, other: BitBoard) -> Self
[src]
impl BitOr<BitBoard> for Square
[src]
type Output = BitBoard
The resulting type after applying the |
operator.
pub fn bitor(self, other: BitBoard) -> Self::Output
[src]
impl BitOr<Square> for BitBoard
[src]
type Output = Self
The resulting type after applying the |
operator.
pub fn bitor(self, other: Square) -> Self
[src]
impl BitOrAssign<BitBoard> for BitBoard
[src]
pub fn bitor_assign(&mut self, rhs: BitBoard)
[src]
impl BitOrAssign<Square> for BitBoard
[src]
pub fn bitor_assign(&mut self, rhs: Square)
[src]
impl BitXor<BitBoard> for BitBoard
[src]
type Output = Self
The resulting type after applying the ^
operator.
pub fn bitxor(self, other: BitBoard) -> Self
[src]
impl BitXor<Square> for BitBoard
[src]
type Output = Self
The resulting type after applying the ^
operator.
pub fn bitxor(self, rhs: Square) -> Self
[src]
impl BitXorAssign<BitBoard> for BitBoard
[src]
pub fn bitxor_assign(&mut self, rhs: BitBoard)
[src]
impl BitXorAssign<Square> for BitBoard
[src]
pub fn bitxor_assign(&mut self, rhs: Square)
[src]
impl Clone for BitBoard
[src]
impl Copy for BitBoard
[src]
impl Debug for BitBoard
[src]
impl Display for BitBoard
[src]
impl Eq 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.
pub fn from_iter<I: IntoIterator<Item = BitBoard>>(iter: I) -> Self
[src]
impl FromIterator<Square> for BitBoard
[src]
A set of squares can be built from an iterator traversing squares.
pub fn from_iter<I: IntoIterator<Item = Square>>(iter: I) -> Self
[src]
impl Hash for BitBoard
[src]
pub fn hash<__H: Hasher>(&self, state: &mut __H)
[src]
pub fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
impl IntoIterator for BitBoard
[src]
A bitboard is a set of squares and is therefore iterable.
type Item = Square
The type of the elements being iterated over.
type IntoIter = BitBoardIterator
Which kind of iterator are we turning this into?
pub fn into_iter(self) -> Self::IntoIter
[src]
impl Not for BitBoard
[src]
impl Ord for BitBoard
[src]
pub fn cmp(&self, other: &BitBoard) -> Ordering
[src]
#[must_use]pub fn max(self, other: Self) -> Self
1.21.0[src]
#[must_use]pub fn min(self, other: Self) -> Self
1.21.0[src]
#[must_use]pub fn clamp(self, min: Self, max: Self) -> Self
1.50.0[src]
impl PartialEq<BitBoard> for BitBoard
[src]
impl PartialOrd<BitBoard> for BitBoard
[src]
pub fn partial_cmp(&self, other: &BitBoard) -> Option<Ordering>
[src]
pub fn lt(&self, other: &BitBoard) -> bool
[src]
pub fn le(&self, other: &BitBoard) -> bool
[src]
pub fn gt(&self, other: &BitBoard) -> bool
[src]
pub fn ge(&self, other: &BitBoard) -> bool
[src]
impl Reflectable for BitBoard
[src]
impl Shl<u8> for BitBoard
[src]
type Output = Self
The resulting type after applying the <<
operator.
pub fn shl(self, shift: u8) -> Self
[src]
impl Shr<u8> for BitBoard
[src]
Operator implementations for bitboards which all use the underlying u64 value.
type Output = Self
The resulting type after applying the >>
operator.
pub fn shr(self, shift: u8) -> Self
[src]
impl StructuralEq for BitBoard
[src]
impl StructuralPartialEq for BitBoard
[src]
impl Sub<BitBoard> for BitBoard
[src]
type Output = Self
The resulting type after applying the -
operator.
pub fn sub(self, other: BitBoard) -> Self
[src]
impl Sub<BitBoard> for Square
[src]
type Output = BitBoard
The resulting type after applying the -
operator.
pub fn sub(self, other: BitBoard) -> Self::Output
[src]
impl Sub<Square> for BitBoard
[src]
Auto Trait Implementations
impl RefUnwindSafe for BitBoard
[src]
impl Send for BitBoard
[src]
impl Sync for BitBoard
[src]
impl Unpin for BitBoard
[src]
impl UnwindSafe for BitBoard
[src]
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T> ToString for T where
T: Display + ?Sized,
[src]
T: Display + ?Sized,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,