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]
impl Board
pub fn new() -> Board
[src]
pub fn new() -> Board
Construct a new Board
that is completely empty.
Note: This does NOT give you the initial position. Just a blank slate.
pub fn from_fen(fen: String) -> Option<Board>
[src]
pub fn from_fen(fen: String) -> Option<Board>
Construct a board from a FEN string.
pub fn status(&self) -> BoardStatus
[src]
pub fn status(&self) -> BoardStatus
Is this game Ongoing, is it Stalemate, or is it Checkmate?
ⓘImportant traits for BitBoardpub fn combined(&self) -> BitBoard
[src]
pub fn combined(&self) -> BitBoard
Grab the "combined" BitBoard
. This is a BitBoard
with every piece.
ⓘImportant traits for BitBoardpub fn color_combined(&self, color: Color) -> BitBoard
[src]
pub fn color_combined(&self, color: Color) -> BitBoard
Grab the "color combined" BitBoard
. This is a BitBoard
with every piece of a particular
color.
pub fn king_square(&self, color: Color) -> Square
[src]
pub fn king_square(&self, color: Color) -> Square
Give me the Square
the color
king is on.
ⓘImportant traits for BitBoardpub fn pieces(&self, piece: Piece) -> BitBoard
[src]
pub fn pieces(&self, piece: Piece) -> BitBoard
Grab the "pieces" BitBoard
. This is a BitBoard
with every piece of a particular type.
pub fn castle_rights(&self, color: Color) -> CastleRights
[src]
pub fn castle_rights(&self, color: Color) -> CastleRights
Grab the CastleRights
for a particular side.
pub fn add_castle_rights(&mut self, color: Color, add: CastleRights)
[src]
pub fn add_castle_rights(&mut self, color: Color, add: CastleRights)
Add castle rights for a particular side.
pub fn remove_castle_rights(&mut self, color: Color, remove: CastleRights)
[src]
pub fn remove_castle_rights(&mut self, color: Color, remove: CastleRights)
Remove castle rights for a particular side.
pub fn side_to_move(&self) -> Color
[src]
pub fn side_to_move(&self) -> Color
Who's turn is it?
pub fn my_castle_rights(&self) -> CastleRights
[src]
pub fn my_castle_rights(&self) -> CastleRights
Grab my CastleRights
.
pub fn add_my_castle_rights(&mut self, add: CastleRights)
[src]
pub fn add_my_castle_rights(&mut self, add: CastleRights)
Add to my CastleRights
.
pub fn remove_my_castle_rights(&mut self, remove: CastleRights)
[src]
pub fn remove_my_castle_rights(&mut self, remove: CastleRights)
Remove some of my CastleRights
.
pub fn their_castle_rights(&self) -> CastleRights
[src]
pub fn their_castle_rights(&self) -> CastleRights
My opponents CastleRights
.
pub fn add_their_castle_rights(&mut self, add: CastleRights)
[src]
pub fn add_their_castle_rights(&mut self, add: CastleRights)
Add to my opponents CastleRights
.
pub fn remove_their_castle_rights(&mut self, remove: CastleRights)
[src]
pub fn remove_their_castle_rights(&mut self, remove: CastleRights)
Remove some of my opponents CastleRights
.
pub fn set_piece(
&self,
piece: Piece,
color: Color,
square: Square
) -> Option<Board>
[src]
pub fn set_piece(
&self,
piece: Piece,
color: Color,
square: Square
) -> Option<Board>
For a chess UI: set a piece on a particular square.
pub fn clear_square(&self, square: Square) -> Option<Board>
[src]
pub fn clear_square(&self, square: Square) -> Option<Board>
For a chess UI: clear a particular square.
pub fn null_move(&self) -> Option<Board>
[src]
pub fn null_move(&self) -> Option<Board>
Switch the color of the player without actually making a move.
pub fn is_sane(&self) -> bool
[src]
pub fn is_sane(&self) -> bool
Does this board "make sense"? Do all the pieces make sense, do the bitboards combine correctly, etc? This is for sanity checking.
pub fn get_hash(&self) -> u64
[src]
pub fn get_hash(&self) -> u64
Get a hash of the board.
pub fn get_pawn_hash(&self) -> u64
[src]
pub fn get_pawn_hash(&self) -> u64
Get a pawn hash of the board (a hash that only changes on color change and pawn moves).
pub fn piece_on(&self, square: Square) -> Option<Piece>
[src]
pub fn piece_on(&self, square: Square) -> Option<Piece>
What piece is on a particular Square
? Is there even one?
pub fn enumerate_moves(&self, moves: &mut [ChessMove; 256]) -> usize
[src]
pub fn enumerate_moves(&self, moves: &mut [ChessMove; 256]) -> usize
Give me all the legal moves for this board.
Note: You may want to build a MoveGen
structure to iterate over
the moves instead.
pub fn en_passant(self) -> Option<Square>
[src]
pub fn en_passant(self) -> Option<Square>
Give me the en_passant square, if it exists.
pub fn legal(&self, m: ChessMove) -> bool
[src]
pub fn legal(&self, m: ChessMove) -> bool
Is a particular move legal?
pub fn legal_quick(&self, chess_move: ChessMove) -> bool
[src]
pub fn legal_quick(&self, chess_move: ChessMove) -> bool
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.
pub fn make_move(&self, m: ChessMove) -> Board
[src]
pub fn make_move(&self, m: ChessMove) -> Board
Make a chess move.
panic!() if king is captured.
pub fn perft(&self, depth: u64) -> u64
[src]
pub fn perft(&self, depth: u64) -> u64
Run a perft-test.
pub fn perft_brute_force(&self, depth: u64) -> u64
[src]
pub fn perft_brute_force(&self, depth: u64) -> u64
Run a perft-test using brute force move generation.
pub fn perft_cache(&self, depth: u64, cache_size_per_depth: usize) -> u64
[src]
pub fn perft_cache(&self, depth: u64, cache_size_per_depth: usize) -> u64
Run a perft test with a cache table.
ⓘImportant traits for BitBoardpub fn pinned(&self) -> BitBoard
[src]
pub fn pinned(&self) -> BitBoard
Give me the BitBoard
of my pinned pieces.
ⓘImportant traits for BitBoardpub fn checkers(&self) -> BitBoard
[src]
pub fn checkers(&self) -> BitBoard
Give me the Bitboard
of the pieces putting me in check.
pub fn legal_king_move(&self, dest: Square) -> bool
[src]
pub fn legal_king_move(&self, dest: Square) -> bool
Is a particular king move legal?
pub fn legal_ep_move(&self, source: Square, dest: Square) -> bool
[src]
pub fn legal_ep_move(&self, source: Square, dest: Square) -> bool
Is a particular en-passant capture legal?
pub fn perft_test(fen: String, depth: u64, result: u64)
[src]
pub fn perft_test(fen: String, depth: u64, result: u64)
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 Copy for Board
impl Clone for Board
[src]
impl Clone for Board
fn clone(&self) -> Board
[src]
fn clone(&self) -> Board
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
impl Display for Board
[src]
impl Display for Board