Struct poirebot::game::position::Position[][src]

pub struct Position {
    pub file_x: u8,
    pub rank_y: u8,
}

Position on the board.

Fields

file_x: u8

The file index, 0 to 7 (maps A to H)

rank_y: u8

The rank index, 0 to 7 (maps 1 to 8)

Implementations

impl Position[src]

pub fn new(file_x: u8, rank_y: u8) -> Result<Position>[src]

Initialize a position from indexes.

pub fn from_notation(notation: &str) -> Result<Position>[src]

Initialize a position from notation (for example: a8).

pub fn flip(&self) -> Self[src]

Rotates the position for the other side.

pub fn forwards(&self, color: Color, inc: u8) -> Self[src]

Returns a new position, forwards by increment in the direction of the given color.

pub fn backwards(&self, color: Color, inc: u8) -> Self[src]

Returns a new position, backwards by increment in the direction of the given color.

pub fn distance_rank(&self, other: &Position) -> u8[src]

Returns the distance between 2 positions on the Y axis (rank).

pub fn to_int(&self) -> u8[src]

Convert to BitBoard notation.

Trait Implementations

impl Clone for Position[src]

impl Copy for Position[src]

impl Debug for Position[src]

impl Display for Position[src]

impl Eq for Position[src]

impl From<&'_ str> for Position[src]

Converts from a notation &str (e.g. "a1"). Note that this function panics if an invalid notation is given. Use Position::from_notation for safer conversion.

impl From<(u8, u8)> for Position[src]

Converts from (file, rank) tuple. Note that this function panics if an invalid values are given. Use Position::new for safer conversion.

impl From<String> for Position[src]

Converts from a notation String (e.g. "a1"). Note that this function panics if an invalid notation is given. Use Position::from_notation for safer conversion.

impl FromIterator<Position> for BitBoard[src]

impl PartialEq<Position> for Position[src]

impl StructuralEq for Position[src]

impl StructuralPartialEq for Position[src]

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> Pointable for T

type Init = T

The type for initializers.

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.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,