Struct alcibiades::Board
[−]
[src]
pub struct Board { pub pieces: PiecesPlacement, pub to_move: Color, pub castling_rights: CastlingRights, pub enpassant_file: usize, pub occupied: Bitboard, }
Holds a chess position.
Fields
pieces: PiecesPlacement
The placement of the pieces on the board.
to_move: Color
The side to move.
castling_rights: CastlingRights
The castling rights for both players.
enpassant_file: usize
If the previous move was a double pawn push, contains pushed
pawn's file (a value between 0 and 7). Otherwise contains 8
.
occupied: Bitboard
The set of all occupied squares on the board.
Always equals self.pieces.color[WHITE] | self.pieces.color[BLACK]
. Deserves a field on its own because
it is very frequently needed.
Methods
impl Board
[src]
fn from_fen(fen: &str) -> Result<Board, IllegalBoard>
Creates a new instance from Forsyth–Edwards Notation (FEN).
fn square(file: usize, rank: usize) -> Square
Returns the square on given file and rank.
file
should be a number between 0 and 7 (0 is file A, 7 is file H).rank
should be a number between 0 and 7 (0 is rank 1, 7 is rank 8).
fn file(square: Square) -> usize
Returns the file of a given square.
The returned number will be between 0 and 7 (0 is file A, 7 is file H).
fn rank(square: Square) -> usize
Returns the rank of a given square.
The returned number will be between 0 and 7 (0 is rank 1, 7 is rank 8).
Trait Implementations
impl Clone for Board
[src]
fn clone(&self) -> Board
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