Struct hexe_core::board::bitboard::Bitboard [] [src]

pub struct Bitboard(pub u64);

A mapping of sixty-four bits to squares of a chess board.

Examples

Iteration

Because Bitboard implements Iterator, its bits can be traversed over with a for loop. This also works in reverse with .rev().

for square in Bitboard::FULL {
    /* ... */
}

Bit Operation Composition

Board components (Square, File, and Rank) can be used first in an operation chain to construct a bitboard.

This syntax should not be misused to create obscure operations that are hard to follow.

let f = File::B;
let r = Rank::Seven;
let s = Square::new(f, r);

assert_eq!(f & r, Bitboard::from(s));
assert_eq!(f | r, r | f);
assert_eq!(s & (f ^ r), Bitboard::EMPTY);

Methods

impl Bitboard
[src]

Bit set operations.

FULL: Bitboard = Bitboard(!0)

An instance with all bits set to 1.

EMPTY: Bitboard = Bitboard(0)

An instance with all bits set to 0.

[src]

Returns whether self contains other.

[src]

Returns whether self intersects with other.

[src]

Returns the number of bits set in self.

[src]

Returns whether self is empty.

[src]

Returns whether self has multiple bits set.

[src]

Converts self into its single bit.

[src]

Returns the least significant bit of self.

[src]

Returns the most significant bit of self.

[src]

Returns the least significant bit of self without checking whether self is empty.

[src]

Returns the least significant bit of self without checking whether self is empty.

[src]

Removes the least significant bit from self.

[src]

Removes the most significant bit from self.

[src]

Removes the least significant bit from self and returns it.

[src]

Removes the most significant bit from self and returns it.

impl Bitboard
[src]

WHITE: Bitboard = Bitboard(!<Self>::BLACK.0)

White board squares.

BLACK: Bitboard = Bitboard(12273903644374837845)

Black board squares.

Important traits for Bitboard
[src]

Returns a Bitboard containing squares between start and end.

Important traits for Bitboard
[src]

Returns a Bitboard line spanning the entire board from edge to edge, intersecting start and end.

[src]

Returns whether self has an empty rank.

[src]

Returns whether the path for right is empty within self.

Important traits for CarryRippler
[src]

Returns an iterator over the subsets of self.

Important traits for Bitboard
[src]

Generates pawn attacks for each of the bits of self.

Important traits for Bitboard
[src]

Generates knight attacks for each of the bits of self.

Important traits for Bitboard
[src]

Generates bishop attacks for each of the bits of self.

Important traits for Bitboard
[src]

Generates rook attacks for each of the bits of self.

Important traits for Bitboard
[src]

Generates king attacks for each of the bits of self.

Important traits for Bitboard
[src]

Generates queen attacks for each of the bits of self.

Important traits for Bitboard
[src]

Returns self advanced by one rank for color.

Important traits for Bitboard
[src]

Returns self retreated by one rank for color.

Important traits for Bitboard
[src]

Returns self shifted in a direction.

Important traits for Bitboard
[src]

Returns self filled in a direction, blocked off by non-empty squares.

[src]

Returns the result of applying a function to a mutable string representation of self.

Trait Implementations

impl From<Bitboard> for CarryRippler
[src]

Important traits for CarryRippler
[src]

Performs the conversion.

impl Copy for Bitboard
[src]

impl Clone for Bitboard
[src]

Important traits for Bitboard
[src]

Returns a copy of the value. Read more

1.0.0
[src]

Performs copy-assignment from source. Read more

impl Default for Bitboard
[src]

Important traits for Bitboard
[src]

Returns the "default value" for a type. Read more

impl Hash for Bitboard
[src]

[src]

Feeds this value into the given [Hasher]. Read more

1.3.0
[src]

Feeds a slice of this type into the given [Hasher]. Read more

impl PartialEq for Bitboard
[src]

[src]

This method tests for self and other values to be equal, and is used by ==. Read more

[src]

This method tests for !=.

impl Eq for Bitboard
[src]

impl Binary for Bitboard
[src]

[src]

Formats the value using the given formatter.

impl Octal for Bitboard
[src]

[src]

Formats the value using the given formatter.

impl LowerHex for Bitboard
[src]

[src]

Formats the value using the given formatter.

impl UpperHex for Bitboard
[src]

[src]

Formats the value using the given formatter.

impl Debug for Bitboard
[src]

[src]

Formats the value using the given formatter. Read more

impl Display for Bitboard
[src]

[src]

Formats the value using the given formatter. Read more

impl<T> Shl<T> for Bitboard where
    u64: Shl<T, Output = u64>, 
[src]

The resulting type after applying the << operator.

[src]

Performs the << operation.

impl<T> ShlAssign<T> for Bitboard where
    u64: ShlAssign<T>, 
[src]

[src]

Performs the <<= operation.

impl<T> Shr<T> for Bitboard where
    u64: Shr<T, Output = u64>, 
[src]

The resulting type after applying the >> operator.

[src]

Performs the >> operation.

impl<T> ShrAssign<T> for Bitboard where
    u64: ShrAssign<T>, 
[src]

[src]

Performs the >>= operation.

impl<T: Into<Bitboard>> BitAnd<T> for Bitboard
[src]

The resulting type after applying the & operator.

[src]

Performs the & operation.

impl<T: Into<Bitboard>> BitAndAssign<T> for Bitboard
[src]

[src]

Performs the &= operation.

impl<T: Into<Bitboard>> BitXor<T> for Bitboard
[src]

The resulting type after applying the ^ operator.

[src]

Performs the ^ operation.

impl<T: Into<Bitboard>> BitXorAssign<T> for Bitboard
[src]

[src]

Performs the ^= operation.

impl<T: Into<Bitboard>> BitOr<T> for Bitboard
[src]

The resulting type after applying the | operator.

[src]

Performs the | operation.

impl<T: Into<Bitboard>> BitOrAssign<T> for Bitboard
[src]

[src]

Performs the |= operation.

impl<T: Into<Bitboard>> Sub<T> for Bitboard
[src]

The resulting type after applying the - operator.

[src]

Performs the - operation.

impl<T: Into<Bitboard>> SubAssign<T> for Bitboard
[src]

[src]

Performs the -= operation.

impl Not for Bitboard
[src]

The resulting type after applying the ! operator.

[src]

Performs the unary ! operation.

impl<A: Into<Bitboard>> FromIterator<A> for Bitboard
[src]

[src]

Creates a value from an iterator. Read more

impl<A: Into<Bitboard>> Extend<A> for Bitboard
[src]

[src]

Extends a collection with the contents of an iterator. Read more

impl Iterator for Bitboard
[src]

The type of the elements being iterated over.

[src]

Advances the iterator and returns the next value. Read more

[src]

Returns the bounds on the remaining length of the iterator. Read more

[src]

Consumes the iterator, counting the number of iterations and returning it. Read more

[src]

Consumes the iterator, returning the last element. Read more

1.0.0
[src]

Returns the nth element of the iterator. Read more

[src]

🔬 This is a nightly-only experimental API. (iterator_step_by)

unstable replacement of Range::step_by

Creates an iterator starting at the same point, but stepping by the given amount at each iteration. Read more

1.0.0
[src]

Takes two iterators and creates a new iterator over both in sequence. Read more

1.0.0
[src]

'Zips up' two iterators into a single iterator of pairs. Read more

1.0.0
[src]

Takes a closure and creates an iterator which calls that closure on each element. Read more

1.21.0
[src]

Calls a closure on each element of an iterator. Read more

1.0.0
[src]

Creates an iterator which uses a closure to determine if an element should be yielded. Read more

1.0.0
[src]

Creates an iterator that both filters and maps. Read more

1.0.0
[src]

Creates an iterator which gives the current iteration count as well as the next value. Read more

1.0.0
[src]

Creates an iterator which can use peek to look at the next element of the iterator without consuming it. Read more

1.0.0
[src]

Creates an iterator that [skip]s elements based on a predicate. Read more

1.0.0
[src]

Creates an iterator that yields elements based on a predicate. Read more

1.0.0
[src]

Creates an iterator that skips the first n elements. Read more

1.0.0
[src]

Creates an iterator that yields its first n elements. Read more

1.0.0
[src]

An iterator adaptor similar to [fold] that holds internal state and produces a new iterator. Read more

1.0.0
[src]

Creates an iterator that works like map, but flattens nested structure. Read more

[src]

🔬 This is a nightly-only experimental API. (iterator_flatten)

Creates an iterator that flattens nested structure. Read more

1.0.0
[src]

Creates an iterator which ends after the first [None]. Read more

1.0.0
[src]

Do something with each element of an iterator, passing the value on. Read more

1.0.0
[src]

Borrows an iterator, rather than consuming it. Read more

1.0.0
[src]

Transforms an iterator into a collection. Read more

1.0.0
[src]

Consumes an iterator, creating two collections from it. Read more

[src]

🔬 This is a nightly-only experimental API. (iterator_try_fold)

An iterator method that applies a function as long as it returns successfully, producing a single, final value. Read more

[src]

🔬 This is a nightly-only experimental API. (iterator_try_fold)

An iterator method that applies a fallible function to each item in the iterator, stopping at the first error and returning that error. Read more

1.0.0
[src]

An iterator method that applies a function, producing a single, final value. Read more

1.0.0
[src]

Tests if every element of the iterator matches a predicate. Read more

1.0.0
[src]

Tests if any element of the iterator matches a predicate. Read more

1.0.0
[src]

Searches for an element of an iterator that satisfies a predicate. Read more

1.0.0
[src]

Searches for an element in an iterator, returning its index. Read more

1.0.0
[src]

Searches for an element in an iterator from the right, returning its index. Read more

1.0.0
[src]

Returns the maximum element of an iterator. Read more

1.0.0
[src]

Returns the minimum element of an iterator. Read more

1.6.0
[src]

Returns the element that gives the maximum value from the specified function. Read more

1.15.0
[src]

Returns the element that gives the maximum value with respect to the specified comparison function. Read more

1.6.0
[src]

Returns the element that gives the minimum value from the specified function. Read more

1.15.0
[src]

Returns the element that gives the minimum value with respect to the specified comparison function. Read more

1.0.0
[src]

Reverses an iterator's direction. Read more

1.0.0
[src]

Converts an iterator of pairs into a pair of containers. Read more

1.0.0
[src]

Creates an iterator which [clone]s all of its elements. Read more

1.0.0
[src]

Repeats an iterator endlessly. Read more

1.11.0
[src]

Sums the elements of an iterator. Read more

1.11.0
[src]

Iterates over the entire iterator, multiplying all the elements Read more

1.5.0
[src]

Lexicographically compares the elements of this Iterator with those of another. Read more

1.5.0
[src]

Lexicographically compares the elements of this Iterator with those of another. Read more

1.5.0
[src]

Determines if the elements of this Iterator are equal to those of another. Read more

1.5.0
[src]

Determines if the elements of this Iterator are unequal to those of another. Read more

1.5.0
[src]

Determines if the elements of this Iterator are lexicographically less than those of another. Read more

1.5.0
[src]

Determines if the elements of this Iterator are lexicographically less or equal to those of another. Read more

1.5.0
[src]

Determines if the elements of this Iterator are lexicographically greater than those of another. Read more

1.5.0
[src]

Determines if the elements of this Iterator are lexicographically greater than or equal to those of another. Read more

impl DoubleEndedIterator for Bitboard
[src]

[src]

Removes and returns an element from the end of the iterator. Read more

[src]

🔬 This is a nightly-only experimental API. (iterator_try_fold)

This is the reverse version of [try_fold()]: it takes elements starting from the back of the iterator. Read more

[src]

🔬 This is a nightly-only experimental API. (iter_rfold)

An iterator method that reduces the iterator's elements to a single, final value, starting from the back. Read more

[src]

🔬 This is a nightly-only experimental API. (iter_rfind)

Searches for an element of an iterator from the right that satisfies a predicate. Read more

impl ExactSizeIterator for Bitboard
[src]

[src]

Returns the exact number of times the iterator will iterate. Read more

[src]

🔬 This is a nightly-only experimental API. (exact_size_is_empty)

Returns whether the iterator is empty. Read more

impl<T: Into<Bitboard>> Contained<Bitboard> for T
[src]

[src]

Returns whether self is contained in other.

impl From<u64> for Bitboard
[src]

[src]

Performs the conversion.

impl AsRef<u64> for Bitboard
[src]

[src]

Performs the conversion.

impl AsMut<u64> for Bitboard
[src]

[src]

Performs the conversion.

impl From<Bitboard> for u64
[src]

[src]

Performs the conversion.

impl AsRef<Bitboard> for u64
[src]

Important traits for Bitboard
[src]

Performs the conversion.

impl AsMut<Bitboard> for u64
[src]

Important traits for Bitboard
[src]

Performs the conversion.

impl From<Square> for Bitboard
[src]

[src]

Performs the conversion.

impl From<File> for Bitboard
[src]

[src]

Performs the conversion.

impl From<Rank> for Bitboard
[src]

[src]

Performs the conversion.

impl From<Color> for Bitboard
[src]

[src]

Performs the conversion.

Auto Trait Implementations

impl Send for Bitboard

impl Sync for Bitboard