Enum chess::castle_rights::CastleRights [] [src]

pub enum CastleRights {
    NoRights,
    KingSide,
    QueenSide,
    Both,
}

What castle rights does a particular player have?

Variants

NoRightsKingSideQueenSideBoth

Methods

impl CastleRights
[src]

fn has_kingside(&self) -> bool

Can I castle kingside?

fn has_queenside(&self) -> bool

Can I castle queenside?

fn kingside_squares(&self, color: Color) -> BitBoard

What squares need to be empty to castle kingside?

fn queenside_squares(&self, color: Color) -> BitBoard

What squares need to be empty to castle queenside?

fn remove(&self, remove: CastleRights) -> CastleRights

Remove castle rights, and return a new CastleRights.

fn to_index(&self) -> usize

Convert CastleRights to usize for table lookups

fn from_index(i: usize) -> CastleRights

Convert usize to CastleRights. Panic if invalid number.

fn unmoved_rooks(&self, color: Color) -> BitBoard

Which rooks can we "guarantee" we haven't moved yet?

fn rook_square_to_castle_rights(square: Square) -> CastleRights

Given a square of a rook, which side is it on? Note: It is invalid to pass in a non-rook square. The code may panic.

Trait Implementations

impl PartialOrd for CastleRights
[src]

fn partial_cmp(&self, __arg_0: &CastleRights) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more

fn lt(&self, other: &Rhs) -> bool
1.0.0

This method tests less than (for self and other) and is used by the < operator. Read more

fn le(&self, other: &Rhs) -> bool
1.0.0

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more

fn gt(&self, other: &Rhs) -> bool
1.0.0

This method tests greater than (for self and other) and is used by the > operator. Read more

fn ge(&self, other: &Rhs) -> bool
1.0.0

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more

impl PartialEq for CastleRights
[src]

fn eq(&self, __arg_0: &CastleRights) -> bool

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

fn ne(&self, other: &Rhs) -> bool
1.0.0

This method tests for !=.

impl Clone for CastleRights
[src]

fn clone(&self) -> CastleRights

Returns a copy of the value. Read more

fn clone_from(&mut self, source: &Self)
1.0.0

Performs copy-assignment from source. Read more

impl Copy for CastleRights
[src]