Struct chess::Board
[−]
[src]
pub struct Board { /* fields omitted */ }
A representation of a chess board. That's why you're here, right?
Methods
impl Board
[src]
fn new() -> Board
[src]
Construct a new Board
that is completely empty.
Note: This does NOT give you the initial position. Just a blank slate.
fn from_fen(fen: String) -> Option<Board>
[src]
Construct a board from a FEN string.
fn status(&self) -> BoardStatus
[src]
Is this game Ongoing, is it Stalemate, or is it Checkmate?
fn combined(&self) -> BitBoard
[src]
Grab the "combined" BitBoard
. This is a BitBoard
with every piece.
fn color_combined(&self, color: Color) -> BitBoard
[src]
Grab the "color combined" BitBoard
. This is a BitBoard
with every piece of a particular
color.
fn king_square(&self, color: Color) -> Square
[src]
Give me the Square
the color
king is on.
fn pieces(&self, piece: Piece) -> BitBoard
[src]
Grab the "pieces" BitBoard
. This is a BitBoard
with every piece of a particular type.
fn castle_rights(&self, color: Color) -> CastleRights
[src]
Grab the CastleRights
for a particular side.
fn add_castle_rights(&mut self, color: Color, add: CastleRights)
[src]
Add castle rights for a particular side.
fn remove_castle_rights(&mut self, color: Color, remove: CastleRights)
[src]
Remove castle rights for a particular side.
fn side_to_move(&self) -> Color
[src]
Who's turn is it?
fn my_castle_rights(&self) -> CastleRights
[src]
Grab my CastleRights
.
fn add_my_castle_rights(&mut self, add: CastleRights)
[src]
Add to my CastleRights
.
fn remove_my_castle_rights(&mut self, remove: CastleRights)
[src]
Remove some of my CastleRights
.
fn their_castle_rights(&self) -> CastleRights
[src]
My opponents CastleRights
.
fn add_their_castle_rights(&mut self, add: CastleRights)
[src]
Add to my opponents CastleRights
.
fn remove_their_castle_rights(&mut self, remove: CastleRights)
[src]
Remove some of my opponents CastleRights
.
fn set_piece(&self, piece: Piece, color: Color, square: Square) -> Option<Board>
[src]
For a chess UI: set a piece on a particular square.
fn clear_square(&self, square: Square) -> Option<Board>
[src]
For a chess UI: clear a particular square.
fn null_move(&self) -> Option<Board>
[src]
Switch the color of the player without actually making a move.
fn is_sane(&self) -> bool
[src]
Does this board "make sense"? Do all the pieces make sense, do the bitboards combine correctly, etc? This is for sanity checking.
fn get_hash(&self) -> u64
[src]
Get a hash of the board.
fn get_pawn_hash(&self) -> u64
[src]
Get a pawn hash of the board (a hash that only changes on color change and pawn moves).
fn piece_on(&self, square: Square) -> Option<Piece>
[src]
What piece is on a particular Square
? Is there even one?
fn enumerate_moves(&self, moves: &mut [ChessMove; 256]) -> usize
[src]
Give me all the legal moves for this board.
Note: You may want to build a MoveGen
structure to iterate over
the moves instead.
fn en_passant(self) -> Option<Square>
[src]
Give me the en_passant square, if it exists.
fn legal(&self, m: ChessMove) -> bool
[src]
Is a particular move legal?
fn legal_quick(&self, chess_move: ChessMove) -> bool
[src]
This function checks the legality only for moves generated by MoveGen
.
Calling this function for moves not generated by MoveGen
will result in possibly
incorrect results, and making that move on the Board
will result in undefined behavior.
This function may panic! if these rules are not followed.
If you are validating a move from a user, you should call the .legal() function.
fn make_move(&self, m: ChessMove) -> Board
[src]
Make a chess move.
panic!() if king is captured.
fn perft(&self, depth: u64) -> u64
[src]
Run a perft-test.
fn perft_brute_force(&self, depth: u64) -> u64
[src]
Run a perft-test using brute force move generation.
fn perft_cache(&self, depth: u64, cache_size_per_depth: usize) -> u64
[src]
Run a perft test with a cache table.
fn pinned(&self) -> BitBoard
[src]
Give me the BitBoard
of my pinned pieces.
fn checkers(&self) -> BitBoard
[src]
Give me the Bitboard
of the pieces putting me in check.
fn legal_king_move(&self, dest: Square) -> bool
[src]
Is a particular king move legal?
fn legal_ep_move(&self, source: Square, dest: Square) -> bool
[src]
Is a particular en-passant capture legal?
fn perft_test(fen: String, depth: u64, result: u64)
[src]
Run every type of perft test, and panic! if the leaf-node count of any version is not equal
to result
.
Trait Implementations
impl Copy for Board
[src]
impl Clone for Board
[src]
fn clone(&self) -> Board
[src]
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more