Enum pleco::core::Player [−][src]
#[repr(u8)]pub enum Player { White, Black, }
Enum to represent the Players White & Black.
Variants
White
Black
Methods
impl Player
[src]
impl Player
pub fn other_player(&self) -> Player
[src]
pub fn other_player(&self) -> Player
Returns the other player.
Examples
use pleco::core::Player; let b = Player::Black; assert_eq!(b.other_player(), Player::White);
pub fn relative_square(&self, sq: SQ) -> SQ
[src]
pub fn relative_square(&self, sq: SQ) -> SQ
Returns the relative square from a given square.
pub fn pawn_push(&self) -> i8
[src]
pub fn pawn_push(&self) -> i8
Gets the direction of a pawn push for a given player.
pub fn relative_rank_of_sq(&self, sq: SQ) -> Rank
[src]
pub fn relative_rank_of_sq(&self, sq: SQ) -> Rank
Returns the relative rank of a square in relation to a player.
Examples
use pleco::core::{Player,Rank}; use pleco::core::sq::SQ; let w = Player::White; let b = Player::Black; assert_eq!(w.relative_rank_of_sq(SQ::A1), Rank::R1); assert_eq!(b.relative_rank_of_sq(SQ::H8), Rank::R1); assert_eq!(b.relative_rank_of_sq(SQ::A1), Rank::R8);
pub fn relative_rank(&self, rank: Rank) -> Rank
[src]
pub fn relative_rank(&self, rank: Rank) -> Rank
Returns the relative rank of a rank in relation to a player.
Examples
use pleco::core::{Player,Rank}; use pleco::core::sq::SQ; let w = Player::White; let b = Player::Black; assert_eq!(w.relative_rank(Rank::R1), Rank::R1); assert_eq!(b.relative_rank(Rank::R8), Rank::R1); assert_eq!(b.relative_rank(Rank::R1), Rank::R8);
Trait Implementations
impl Copy for Player
[src]
impl Copy for Player
impl Clone for Player
[src]
impl Clone for Player
fn clone(&self) -> Player
[src]
fn clone(&self) -> Player
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
fn clone_from(&mut self, source: &Self)
1.0.0
[src]Performs copy-assignment from source
. Read more
impl Debug for Player
[src]
impl Debug for Player
fn fmt(&self, f: &mut Formatter) -> Result
[src]
fn fmt(&self, f: &mut Formatter) -> Result
Formats the value using the given formatter. Read more
impl PartialEq for Player
[src]
impl PartialEq for Player
fn eq(&self, other: &Player) -> bool
[src]
fn eq(&self, other: &Player) -> 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[src]
fn ne(&self, other: &Rhs) -> bool
1.0.0
[src]This method tests for !=
.
impl Not for Player
[src]
impl Not for Player
type Output = Player
The resulting type after applying the !
operator.
fn not(self) -> Self::Output
[src]
fn not(self) -> Self::Output
Performs the unary !
operation.
impl Display for Player
[src]
impl Display for Player