Type Alias Square

Source
pub type Square = usize;
Expand description

Square type represents a square of a chess board as an unsigned int

Trait Implementations§

Source§

impl SquareTrait for Square

SquareTrait adds methods to a Square

Source§

fn from_uci(uci: String) -> (Square, bool)

creates Square from uci

Source§

fn rank(self) -> Rank

returns the rank of the square

Source§

fn file(self) -> File

returns the file of the square

Source§

fn uci(self) -> String

returns the UCI representation of the square

Source§

fn bitboard(self) -> Bitboard

returns an otherwise empty bitboard with the bit for this square set

Source§

fn add_delta(self, delta: &Delta) -> (Square, bool)

adds a delta to a square and returns the resulting square together with a bool indicating whether adding was a success

Source§

fn add_delta_occup(self, delta: &Delta, occup: Bitboard) -> (Square, bool)

same as add_delta, but also fails if the resulting square is occupied