pub enum CastleZone {
WK,
WQ,
BK,
BQ,
}
Expand description
Represents one of the four different areas on a chessboard where the special castling move can take place (two for each side).
Variants§
Implementations§
Source§impl CastleZone
impl CastleZone
Sourcepub fn kingside(side: Side) -> CastleZone
pub fn kingside(side: Side) -> CastleZone
Return the kingside zone for the given side.
Sourcepub fn queenside(side: Side) -> CastleZone
pub fn queenside(side: Side) -> CastleZone
Return the queenside zone for the given side.
Sourcepub fn iter() -> impl Iterator<Item = CastleZone>
pub fn iter() -> impl Iterator<Item = CastleZone>
Create an iterator traversing all zones in order.
Sourcepub fn source_squares(self) -> BitBoard
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.
Sourcepub fn rook_data(self) -> (Piece, Square, Square)
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.
Sourcepub fn king_data(self) -> (Piece, Square, Square)
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.
Sourcepub fn unoccupied_requirement(self) -> BitBoard
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.
Sourcepub fn uncontrolled_requirement(self) -> BitBoard
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.
Sourcepub fn lift(self) -> EnumSet<CastleZone>
pub fn lift(self) -> EnumSet<CastleZone>
Lifts this zone to a set of one element.
Trait Implementations§
Source§impl<O: Into<EnumSet<CastleZone>>> BitAnd<O> for CastleZone
impl<O: Into<EnumSet<CastleZone>>> BitAnd<O> for CastleZone
Source§impl<O: Into<EnumSet<CastleZone>>> BitOr<O> for CastleZone
impl<O: Into<EnumSet<CastleZone>>> BitOr<O> for CastleZone
Source§impl<O: Into<EnumSet<CastleZone>>> BitXor<O> for CastleZone
impl<O: Into<EnumSet<CastleZone>>> BitXor<O> for CastleZone
Source§impl Clone for CastleZone
impl Clone for CastleZone
Source§impl Debug for CastleZone
impl Debug for CastleZone
Source§impl Display for CastleZone
impl Display for CastleZone
Source§impl EnumSetTypePrivate for CastleZone
impl EnumSetTypePrivate for CastleZone
Source§const CONST_HELPER_INSTANCE: __EnumSetConstHelper = __EnumSetConstHelper
const CONST_HELPER_INSTANCE: __EnumSetConstHelper = __EnumSetConstHelper
ConstHelper
.Source§const ALL_BITS: Self::Repr = {transmute(0x0f): <castlezone::CastleZone as enumset::__internal::EnumSetTypePrivate>::Repr}
const ALL_BITS: Self::Repr = {transmute(0x0f): <castlezone::CastleZone as enumset::__internal::EnumSetTypePrivate>::Repr}
Source§const VARIANT_COUNT: u32 = 4u32
const VARIANT_COUNT: u32 = 4u32
Source§type ConstHelper = __EnumSetConstHelper
type ConstHelper = __EnumSetConstHelper
enum_set!
macro among other things.Source§fn enum_into_u32(self) -> u32
fn enum_into_u32(self) -> u32
Source§unsafe fn enum_from_u32(val: u32) -> Self
unsafe fn enum_from_u32(val: u32) -> Self
Source§impl FromStr for CastleZone
impl FromStr for CastleZone
Source§impl Hash for CastleZone
impl Hash for CastleZone
Source§impl Not for CastleZone
impl Not for CastleZone
Source§impl Ord for CastleZone
impl Ord for CastleZone
Source§fn cmp(&self, other: &CastleZone) -> Ordering
fn cmp(&self, other: &CastleZone) -> Ordering
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl PartialEq<EnumSet<CastleZone>> for CastleZone
impl PartialEq<EnumSet<CastleZone>> for CastleZone
Source§impl PartialEq for CastleZone
impl PartialEq for CastleZone
Source§impl PartialOrd for CastleZone
impl PartialOrd for CastleZone
Source§impl Reflectable for CastleZone
A castle is reflected by it’s side, i.e.
impl Reflectable for CastleZone
A castle is reflected by it’s side, i.e.
- WK <==> BK
- WQ <==> BQ
Source§impl<O: Into<EnumSet<CastleZone>>> Sub<O> for CastleZone
impl<O: Into<EnumSet<CastleZone>>> Sub<O> for CastleZone
impl Copy for CastleZone
impl EnumSetType for CastleZone
impl Eq for CastleZone
Auto Trait Implementations§
impl Freeze for CastleZone
impl RefUnwindSafe for CastleZone
impl Send for CastleZone
impl Sync for CastleZone
impl Unpin for CastleZone
impl UnwindSafe for CastleZone
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more