[]Enum myopic_brain::CastleZone

pub enum CastleZone {
    WK,
    WQ,
    BK,
    BQ,
}

Represents one of the four different areas on a chessboard where the special castling move can take place (two for each side).

Variants

WK
WQ
BK
BQ

Implementations

impl CastleZone

pub fn side(&self) -> Side

Return the side which this zone belongs to.

pub fn kingside(side: Side) -> CastleZone

Return the kingside zone for the given side.

pub fn queenside(side: Side) -> CastleZone

Return the queenside zone for the given side.

pub fn iter() -> impl Iterator<Item = CastleZone>

Create an iterator traversing all zones in order.

pub fn source_squares(self) -> BitBoard

Returns a set of exactly two squares which denote the required locations of the king and rook in order for the corresponding castle move to take place.

pub fn rook_data(self) -> (Piece, Square, Square)

Returns a triple containing the rook which moves in the corresponding castle move along with it's required start square followed by the square it will finish on.

pub fn king_data(self) -> (Piece, Square, Square)

Returns a triple containing the king which moves in the corresponding castle move along with it's required start square followed by the square it will finish on.

pub fn unoccupied_requirement(self) -> BitBoard

Returns a set containing the squares which are required to be free of any other pieces in order for the corresponding castle move to be legal.

pub fn uncontrolled_requirement(self) -> BitBoard

Returns a set containing the squares which are required to be free of enemy control in order for the corresponding castle move to be legal.

pub fn lift(self) -> CastleZoneSet

Lifts this zone to a set of one element.

Trait Implementations

impl Clone for CastleZone

impl Copy for CastleZone

impl Debug for CastleZone

impl Display for CastleZone

impl Eq for CastleZone

impl FromIterator<CastleZone> for CastleZoneSet

impl FromStr for CastleZone

type Err = Error

The associated error which can be returned from parsing.

impl Hash for CastleZone

impl Ord for CastleZone

impl PartialEq<CastleZone> for CastleZone

impl PartialOrd<CastleZone> for CastleZone

impl Reflectable for CastleZone

A castle is reflected by it's side, i.e.

  • WK <==> BK
  • WQ <==> BQ

impl StructuralEq for CastleZone

impl StructuralPartialEq for CastleZone

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.