Enum pleco::core::Player [] [src]

pub enum Player {
    White,
    Black,
}

Enum to represent the Players White & Black.

Variants

Methods

impl Player
[src]

[src]

Returns the other player.

Examples

use pleco::core::Player;

let b = Player::Black;
assert_eq!(b.other_player(), Player::White);

[src]

Returns the relative square from a given square.

[src]

Gets the direction of a pawn push for a given player.

[src]

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);

[src]

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 Clone for Player
[src]

[src]

Returns a copy of the value. Read more

1.0.0
[src]

Performs copy-assignment from source. Read more

impl Debug for Player
[src]

[src]

Formats the value using the given formatter.

impl PartialEq for Player
[src]

[src]

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

1.0.0
[src]

This method tests for !=.

impl Display for Player
[src]

[src]

Formats the value using the given formatter. Read more