[−][src]Struct pleco::board::Board
Represents a Chessboard through a Board
.
Board contains everything that needs to be known about the current state of the Game. It is used by both Engines and Players / Bots alike.
Ideally, the Engine contains the original Representation of a board (owns the board), and utilizes
Board::shallow_clone()
to share this representaion with Players.
Examples
use pleco::Board; fn main() { let mut chessboard = Board::default(); let moves = chessboard.generate_moves(); chessboard.apply_move(moves[0]); let b2 = chessboard.shallow_clone(); // boards allow for easy cloning assert_eq!(chessboard.moves_played(), b2.moves_played()); }
BitBoard
Representation
For the majority of the struct, the board utilizes BitBoards, which is a u64 where each bit represents an occupied location, and each bit index represents a certain square (as in bit 0 is Square A1, bit 1 is B1, etc.). Indexes increase first horizontally by File, and then by Rank. See BitBoards article ChessWiki for more information.
The exact mapping from each square to bits is as follows:
8 | 56 57 58 59 60 61 62 63
7 | 48 49 50 51 52 53 54 55
6 | 40 41 42 43 44 45 46 47
5 | 32 33 34 35 36 37 38 39
4 | 24 25 26 27 28 29 30 31
3 | 16 17 18 19 20 21 22 23
2 | 8 9 10 11 12 13 14 15
1 | 0 1 2 3 4 5 6 7
-------------------------
a b c d e f g h
Methods
impl Board
[src]
pub fn start_pos() -> Board
[src]
Constructs a board from the starting position
Examples
use pleco::{Board,Player}; let chessboard = Board::start_pos(); assert_eq!(chessboard.count_pieces_player(Player::White),16);
pub fn shallow_clone(&self) -> Board
[src]
Constructs a shallow clone of the Board.
Contains only the information necessary to apply future moves, more specifically does not clone the moves list, and sets depth to zero. Intended for an Engine or main thread to share the board to users wanting to search.
Safety
After this method has called, Board::undo_move() cannot be called immediately after. Undoing moves can only be done once a move has been played, and cannot be called more times than moves have been played since calling Board::shallow_clone().
Examples
use pleco::Board; let mut chessboard = Board::start_pos(); let moves = chessboard.generate_moves(); // generate all possible legal moves chessboard.apply_move(moves[0]); // apply first move assert_eq!(chessboard.moves_played(), 1); let board_clone = chessboard.shallow_clone(); assert_eq!(chessboard.moves_played(), board_clone.moves_played()); assert_ne!(chessboard.depth(),board_clone.depth()); // different depths
pub fn parallel_clone(&self) -> Board
[src]
Constructs a parallel clone of the Board.
Similar to Board::shallow_clone()
, but keeps the current search depth the same.
Should be used when implementing a searcher, and want to search a list of moves
in parallel with different threads.
Safety
After this method has called, Board::undo_move()
cannot be called immediately after.
Undoing moves can only be done once a move has been played, and cannot be called more
times than moves have been played since calling Board::parallel_clone()
.
Examples
use pleco::Board; let mut chessboard = Board::start_pos(); let moves = chessboard.generate_moves(); // generate all possible legal moves chessboard.apply_move(moves[0]); assert_eq!(chessboard.moves_played(), 1); let board_clone = chessboard.parallel_clone(); assert_eq!(chessboard.moves_played(), board_clone.moves_played()); assert_eq!(chessboard.depth(),board_clone.depth()); // different depths
pub fn random() -> RandBoard
[src]
Creates a RandBoard
(Random Board Generator) for generation of Board
s with random
positions. See the RandBoard
structure for more information.
Examples
Create one Board
with at least 5 moves played that is created in a pseudo-random
fashion.
use pleco::Board; let rand_boards: Board = Board::random() .pseudo_random(6622225) .min_moves(5) .one();
Create a Vec
of 3 random Board
s that are guaranteed to not be in check.
use pleco::board::{Board,RandBoard}; let rand_boards: Vec<Board> = Board::random() .no_check() .many(3);
pub fn from_fen(fen: &str) -> Result<Board, FenBuildError>
[src]
Constructs a board from a FEN String.
FEN stands for Forsyth-Edwards Notation, and is a way of representing a board through a string of characters. More information can be found on the ChessWiki.
Examples
use pleco::Board; let board = Board::from_fen("rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1").unwrap(); assert_eq!(board.count_all_pieces(),32); let obviously_not_a_fen = "This shouldn't parse!"; let bad_board = Board::from_fen(obviously_not_a_fen); assert!(bad_board.is_err());
Safety
The FEN string must be valid, or else the method will return an Error.
There is a possibility of the FEN string representing an unvalid position, with no panics resulting. The Constructed Board may have some Undefined Behavior as a result. It is up to the user to give a valid FEN string.
pub fn fen(&self) -> String
[src]
Creates a FEN String of the Given Board.
FEN stands for Forsyth-Edwards Notation, and is a way of representing a board through a string of characters. More information can be found on the ChessWiki.
Examples
use pleco::Board; let board = Board::start_pos(); assert_eq!(board.fen(),"rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1");
pub fn apply_move(&mut self, bit_move: BitMove)
[src]
Applies a move to the Board.
Safety
The passed in BitMove
must be a legal move for the current position.
Panics
The supplied BitMove must be both a valid move for that position, as well as a
valid BitMove
, Otherwise, a panic will occur. Valid BitMoves can be generated with
Board::generate_moves()
, which guarantees that only Legal moves will be created.
pub fn apply_move_pft_chk<PT, MT>(
&mut self,
bit_move: BitMove,
gives_check: bool,
pawn_table: &PT,
material_table: &MT
) where
PT: PreFetchable,
MT: PreFetchable,
[src]
&mut self,
bit_move: BitMove,
gives_check: bool,
pawn_table: &PT,
material_table: &MT
) where
PT: PreFetchable,
MT: PreFetchable,
Applies a move to the Board. This method is only useful if before a move is applied to
a board, the ability of the move to give check is applied. If it is not needed to know
if the move gives check or not, consider using Board::apply_move
instead.
This method also takes in two generic parameters implementing PreFetchable
, one of which
will prefetch from the A table taking in a pawn key, the other of which pre-fetching
from a table utilizing the material key.
Safety
The passed in BitMove
must be a legal move for the current position, and the gives_check
parameter must be correct for the move.
Panics
The supplied BitMove must be both a valid move for that position, as well as a
valid BitMove
, Otherwise, a panic will occur. Valid BitMoves can be generated with
Board::generate_moves()
, which guarantees that only Legal moves will be created.
The second parameter, gives_check
, must be true if the move gives check, or false
if the move doesn't give check. If an incorrect gives_check
is supplied, undefined
behavior will follow.
pub fn apply_uci_move(&mut self, uci_move: &str) -> bool
[src]
Applies a UCI move to the board. If the move is a valid string representing a UCI move, then true will be returned & the move will be applied. Otherwise, false is returned and the board isn't changed.
Examples
use pleco::Board; let mut board = Board::start_pos(); let success = board.apply_uci_move("e2e4"); assert!(success);
pub fn undo_move(&mut self)
[src]
Un-does the previously applied move, allowing the Board to return to it's most recently held state.
Panics
Cannot be done if after any Board::shallow_clone()
has been applied,
or if Board::parallel_clone()
has been done and there is no previous move.
Examples
use pleco::Board; let mut chessboard = Board::start_pos(); let moves = chessboard.generate_moves(); chessboard.apply_move(moves[0]); let mut board_clone = chessboard.shallow_clone(); chessboard.undo_move(); // works, chessboard existed before the move was played board_clone.undo_move(); // error: board_clone was created after the move was applied
pub unsafe fn apply_null_move(&mut self)
[src]
Apply a "Null Move" to the board, essentially swapping the current turn of the board without moving any pieces.
Safety
This method should only be used for special evaluation purposes, as it does not give an accurate or legal state of the chess board.
Unsafe as it allows for Null Moves to be applied in states of check, which is never a valid state of a chess game.
Panics
Panics if the Board is currently in check.
Examples
use pleco::board::*; let mut chessboard = Board::start_pos(); let board_clone = chessboard.shallow_clone(); unsafe { chessboard.apply_null_move(); } assert_ne!(chessboard.depth(), board_clone.depth());
pub unsafe fn undo_null_move(&mut self)
[src]
Undo a "Null Move" to the Board, returning to the previous state.
Safety
This method should only be used if it can be guaranteed that the last played move from
the current state is a Null-Move, eg Board::apply_null_move()
. Otherwise, a panic will occur.
Examples
use pleco::board::*; let mut chessboard = Board::start_pos(); let board_clone = chessboard.shallow_clone(); unsafe { chessboard.apply_null_move(); } assert_ne!(chessboard.ply(), board_clone.ply()); unsafe { chessboard.undo_null_move(); } assert_eq!(chessboard.moves_played(), board_clone.moves_played()); assert_eq!(chessboard.fen(), board_clone.fen());
pub fn generate_moves(&self) -> MoveList
[src]
Get a List of legal BitMove
s for the player whose turn it is to move.
This method already takes into account if the Board is currently in check, and will return legal moves only.
Examples
use pleco::Board; let chessboard = Board::start_pos(); let moves = chessboard.generate_moves(); println!("There are {} possible legal moves.", moves.len());
pub fn generate_scoring_moves(&self) -> ScoringMoveList
[src]
Get a List of legal BitMove
s (alongside a score) for the player whose turn it is to move.
This method already takes into account if the Board is currently in check, and will return
legal moves only. The ScoringMoveList
that is returned will have a value of zero for each
move.
pub fn generate_pseudolegal_moves(&self) -> MoveList
[src]
Get a List of all PseudoLegal BitMove
s for the player whose turn it is to move.
Works exactly the same as Board::generate_moves()
, but doesn't guarantee that all
the moves are legal for the current position. Moves need to be checked with a
Board::legal_move(move)
in order to be certain of a legal move.
pub fn generate_moves_of_type(&self, gen_type: GenTypes) -> MoveList
[src]
Get a List of legal BitMove
s for the player whose turn it is to move and of a certain type.
This method already takes into account if the Board is currently in check, and will return
legal moves only. If a non-ALL GenTypes
is supplied, only a subset of the total moves will be given.
Panics
Panics if given GenTypes::QuietChecks
while the current board is in check
Examples
use pleco::board::*; use pleco::core::GenTypes; let chessboard = Board::start_pos(); let capturing_moves = chessboard.generate_moves_of_type(GenTypes::Captures); assert_eq!(capturing_moves.len(), 0); // no possible captures for the starting position
pub fn generate_pseudolegal_moves_of_type(&self, gen_type: GenTypes) -> MoveList
[src]
Get a List of all PseudoLegal BitMove
s for the player whose turn it is to move.
Works exactly the same as Board::generate_moves()
, but doesn't guarantee that all
the moves are legal for the current position. Moves need to be checked with a
Board::legal_move(move)
in order to be certain of a legal move.
This method already takes into account if the Board is currently in check. If a non-ALL GenType is supplied, only a subset of the total moves will be given.
Panics
Panics if given GenTypes::QuietChecks
while the current board is in check
ⓘImportant traits for BitBoardpub fn slider_blockers(
&self,
sliders: BitBoard,
s: SQ,
pinners: &mut BitBoard
) -> BitBoard
[src]
&self,
sliders: BitBoard,
s: SQ,
pinners: &mut BitBoard
) -> BitBoard
Outputs the Blockers of a given square.
pub fn turn(&self) -> Player
[src]
Get the Player whose turn it is to move.
Examples
use pleco::{Board,Player}; let chessboard = Board::start_pos(); assert_eq!(chessboard.turn(), Player::White);
pub fn zobrist(&self) -> u64
[src]
Return the Zobrist Hash of the board.
pub fn pawn_key(&self) -> u64
[src]
Return the pawn key of the board.
This is a semi-unique key for any configuration of pawns on the board.
pub fn moves_played(&self) -> u16
[src]
Get the total number of moves played.
Examples
use pleco::Board; let mut chessboard = Board::start_pos(); assert_eq!(chessboard.moves_played(), 0); let moves = chessboard.generate_moves(); chessboard.apply_move(moves[0]); assert_eq!(chessboard.moves_played(), 1);
pub fn depth(&self) -> u16
[src]
Get the current depth (half moves from a Board::shallow_clone().
pub fn rule_50(&self) -> i16
[src]
Get the number of half-moves since a Pawn Push, castle, or capture.
pub fn piece_captured_last_turn(&self) -> PieceType
[src]
Return the Piece, if any, that was last captured.
pub fn ply(&self) -> u16
[src]
Get the current ply of the board.
A ply is determined as the number of moves that have been played on the
current Board
. A simpler way to explain it would be counting the number
of times Board::undo_move()
can be legally applied.
pub fn psq(&self) -> Score
[src]
Returns the current positional Score of the board. Positive scores are in favor of the white player, while negative scores are in favor of the black player.
pub fn ep_square(&self) -> SQ
[src]
Get the current square of en-passant. This is defined not as the pawn that could be captured from an en-passant move, but rather the square directly behind it.
Safety
While it returns a SQ
, this square could be SQ::NONE
, meaning there is no actual
en-passant square.
Examples
use pleco::{Board,SQ}; let chessboard = Board::start_pos(); assert_eq!(chessboard.ep_square(), SQ::NONE);
ⓘImportant traits for BitBoardpub fn occupied(&self) -> BitBoard
[src]
Gets the BitBoard of all pieces.
Examples
use pleco::{Board,BitBoard}; let chessboard = Board::start_pos(); assert_eq!(chessboard.occupied().0, 0xFFFF00000000FFFF);
pub fn empty(&self, sq: SQ) -> bool
[src]
Returns a if a SQ
is empty on the current Board
.
Examples
use pleco::{Board,SQ}; let chessboard = Board::start_pos(); assert!(chessboard.empty(SQ::F6)); assert!(!chessboard.empty(SQ::A2));
ⓘImportant traits for BitBoardpub fn get_occupied_player(&self, player: Player) -> BitBoard
[src]
Get the BitBoard of the squares occupied by the given player.
Examples
use pleco::{Board,Player,BitBoard}; let chessboard = Board::start_pos(); assert_eq!(chessboard.get_occupied_player(Player::White).0, 0x000000000000FFFF);
ⓘImportant traits for BitBoardpub fn occupied_white(&self) -> BitBoard
[src]
Returns a Bitboard consisting of only the squares occupied by the White Player.
Examples
use pleco::{Board,BitBoard}; let chessboard = Board::start_pos(); assert_eq!(chessboard.occupied_white(), BitBoard::RANK_1 | BitBoard::RANK_2);
ⓘImportant traits for BitBoardpub fn occupied_black(&self) -> BitBoard
[src]
Returns a BitBoard consisting of only the squares occupied by the Black Player.
Examples
use pleco::{Board,BitBoard}; let chessboard = Board::start_pos(); assert_eq!(chessboard.occupied_black(), BitBoard::RANK_8 | BitBoard::RANK_7);
ⓘImportant traits for BitBoardpub fn piece_bb(&self, player: Player, piece: PieceType) -> BitBoard
[src]
Returns BitBoard of a single player and that one type of piece.
Examples
use pleco::Board; use pleco::{Player,PieceType}; let chessboard = Board::start_pos(); assert_eq!(chessboard.piece_bb(Player::White,PieceType::P).0, 0x000000000000FF00);
ⓘImportant traits for BitBoardpub fn sliding_piece_bb(&self, player: Player) -> BitBoard
[src]
Returns the BitBoard of the Queens and Rooks of a given player.
Examples
use pleco::{Board,Player,BitBoard}; use pleco::core::bit_twiddles::*; let chessboard = Board::start_pos(); assert_eq!(chessboard.sliding_piece_bb(Player::White).count_bits(), 3);
ⓘImportant traits for BitBoardpub fn diagonal_piece_bb(&self, player: Player) -> BitBoard
[src]
Returns the BitBoard of the Queens and Bishops of a given player.
Examples
use pleco::{Board,Player,BitBoard}; use pleco::core::bit_twiddles::*; let chessboard = Board::start_pos(); assert_eq!(chessboard.diagonal_piece_bb(Player::White).count_bits(), 3);
ⓘImportant traits for BitBoardpub fn piece_bb_both_players(&self, piece: PieceType) -> BitBoard
[src]
Returns the combined BitBoard of both players for a given piece.
Examples
use pleco::{Board,PieceType}; let chessboard = Board::start_pos(); assert_eq!(chessboard.piece_bb_both_players(PieceType::P).0, 0x00FF00000000FF00);
ⓘImportant traits for BitBoardpub fn piece_two_bb_both_players(
&self,
piece: PieceType,
piece2: PieceType
) -> BitBoard
[src]
&self,
piece: PieceType,
piece2: PieceType
) -> BitBoard
Returns the combined BitBoard of both players for two pieces.
Examples
use pleco::{Board,PieceType,BitBoard}; use pleco::core::bit_twiddles::*; let chessboard = Board::start_pos(); assert_eq!(chessboard.piece_two_bb_both_players(PieceType::Q,PieceType::K).count_bits(), 4);
ⓘImportant traits for BitBoardpub fn piece_two_bb(
&self,
piece: PieceType,
piece2: PieceType,
player: Player
) -> BitBoard
[src]
&self,
piece: PieceType,
piece2: PieceType,
player: Player
) -> BitBoard
Returns the BitBoard
containing the locations of two given types of pieces for the given
player.
pub fn count_piece(&self, player: Player, piece: PieceType) -> u8
[src]
Get the total number of pieces of the given piece and player.
Examples
use pleco::{Board,Player,PieceType}; let chessboard = Board::start_pos(); assert_eq!(chessboard.count_piece(Player::White, PieceType::P), 8);
pub fn count_pieces_player(&self, player: Player) -> u8
[src]
Get the total number of pieces a given player has.
Examples
use pleco::{Board,Player,PieceType}; use pleco::core::bit_twiddles::*; let chessboard = Board::start_pos(); assert_eq!(chessboard.count_pieces_player(Player::White), 16);
pub fn count_all_pieces(&self) -> u8
[src]
Get the total number of pieces on the board.
Examples
use pleco::{Board,Player,PieceType}; use pleco::core::bit_twiddles::*; let chessboard = Board::start_pos(); assert_eq!(chessboard.count_all_pieces(), 32);
pub fn piece_at_sq(&self, sq: SQ) -> Piece
[src]
pub fn king_sq(&self, player: Player) -> SQ
[src]
Returns the square of the King for a given player.
Examples
use pleco::{Board,Player,SQ}; let board = Board::start_pos(); assert_eq!(board.king_sq(Player::White), SQ::E1);
ⓘImportant traits for BitBoardpub fn pinned_pieces(&self, player: Player) -> BitBoard
[src]
Returns the pinned pieces of the given player.
Pinned is defined as pinned to the same players king
ⓘImportant traits for BitBoardpub fn all_pinned_pieces(&self, player: Player) -> BitBoard
[src]
Returns the pinned pieces for a given players king. Can contain piece of from both players, but all are guaranteed to be pinned to the given player's king.
ⓘImportant traits for BitBoardpub fn pinning_pieces(&self, player: Player) -> BitBoard
[src]
Returns the pinning pieces of a given player.
E.g., pieces that are pinning a piece to the opponent's king. This will return the pinned pieces of both players, pinned to the given player's king.
pub fn castling_bits(&self) -> u8
[src]
Returns the raw castling rights bits of the board.
pub fn can_castle(&self, player: Player, castle_type: CastleType) -> bool
[src]
Return if a player has the possibility of castling for a given CastleType. This does not ensure a castling is possible for the player, just that the player has the castling-right available.
pub fn player_can_castle(&self, player: Player) -> Castling
[src]
Returns the Castling
structure of a player, which marks whether or not
a player has the rights to castle.
pub fn castle_impeded(&self, castle_type: CastleType) -> bool
[src]
Check if the castle path is impeded for the current player. Does not assume that the current player has the ability to castle, whether by having the castling-rights to, or having the rook and king be in the correct square.
pub fn castling_rook_square(&self, castle_type: CastleType) -> SQ
[src]
Square of the Rook that is involved with the current player's castle.
pub fn last_move(&self) -> Option<BitMove>
[src]
Return the last move played, if any.
pub fn piece_last_captured(&self) -> PieceType
[src]
Returns if the piece (if any) that was captured last move. This method does not distinguish between not having any last move played and not having a piece last captured.
pub fn material_key(&self) -> u64
[src]
Returns the material key of the board.
pub fn non_pawn_material(&self, player: Player) -> Value
[src]
Returns the current non-pawn material value of a player.
pub fn non_pawn_material_all(&self) -> Value
[src]
Returns the current non-pawn material value for both players.
pub fn in_check(&self) -> bool
[src]
Returns if current side to move is in check.
pub fn checkmate(&self) -> bool
[src]
Return if the current side to move is in check mate.
This method can be computationally expensive, do not use outside of Engines.
pub fn stalemate(&self) -> bool
[src]
Returns if the current side to move is in stalemate.
This method can be computationally expensive, do not use outside of Engines.
ⓘImportant traits for BitBoardpub fn checkers(&self) -> BitBoard
[src]
Return the BitBoard
of all checks on the current player's king. If the current side
to move is not in check, the BitBoard
will be empty.
ⓘImportant traits for BitBoardpub fn discovered_check_candidates(&self) -> BitBoard
[src]
Returns the BitBoard
of pieces the current side can move to discover check.
Discovered check candidates are pieces for the current side to move, that are currently
blocking a check from another piece of the same color.
ⓘImportant traits for BitBoardpub fn pieces_pinned(&self, player: Player) -> BitBoard
[src]
Gets the Pinned pieces for the given player. A pinned piece is defined as a piece that if suddenly removed, the player would find itself in check.
ⓘImportant traits for BitBoardpub fn attackers_to(&self, sq: SQ, occupied: BitBoard) -> BitBoard
[src]
Returns a BitBoard of possible attacks / defends to a square with a given occupancy. Includes pieces from both players.
ⓘImportant traits for BitBoardpub fn attacks_from(&self, piece: PieceType, sq: SQ, player: Player) -> BitBoard
[src]
Given a piece, square, and player, returns all squares the piece may possibly move to.
pub fn pawn_passed(&self, player: Player, sq: SQ) -> bool
[src]
Returns if a pawn on a given square is passed.
pub fn legal_move(&self, m: BitMove) -> bool
[src]
Tests if a given pseudo-legal move is a legal. This is mostly for checking the legality of moves that were generated in a pseudo-legal fashion. Generating moves like this is faster, but doesn't guarantee legality due to the possibility of a discovered check happening.
Safety
Assumes the move is legal for the current board.
pub fn pseudo_legal_move(&self, m: BitMove) -> bool
[src]
Rakes a random move and tests whether the move is pseudo-legal. Used to validate moves from the Transposition Table.
Safety
Using this method does not guarantee that a move is legal. It only guarantee's that
a move may possibly legal. To guarantee a move is completely legal for the position,
use Board::pseudo_legal_move()
followed by a Board::legal_move()
.
pub fn opposite_bishops(&self) -> bool
[src]
Returns if the board contains only two bishops, one for each color, and each being on different squares.
pub fn advanced_pawn_push(&self, mov: BitMove) -> bool
[src]
Checks if a move is an advanced pawn push, meaning it passes into enemy territory.
pub fn is_capture(&self, mov: BitMove) -> bool
[src]
Returns if a move is a capture.
This is similar to BitMove::is_capture
, but instead comapres the move to the Board
s
data, rather than relying on the information encoded in the move.
pub fn is_capture_or_promotion(&self, mov: BitMove) -> bool
[src]
Returns if a move is a capture.
This is similar to BitMove::is_capture
& BitMove::is_promo
, but instead comapres the
move to the Board
s data, rather than relying on the information encoded in the move.
pub fn gives_check(&self, m: BitMove) -> bool
[src]
Returns if a move gives check to the opposing player's King.
Safety
Assumes the move is legal for the current board.
pub fn see_ge(&self, mov: BitMove, threshold: i32) -> bool
[src]
see_ge
stands for Static Exchange Evaluation, Greater or Equal. This teats if the
Static Exchange Evaluation of a move is greater than or equal to a value.
This is a recursive algorithm that works by checking the destination square of the given move, and attempting to repeatedly capture that spot for both players.
If the move is invalid for the current board, false
will be returned regardless
of the threshold.
pub fn moved_piece(&self, m: BitMove) -> Piece
[src]
Returns the piece that was moved from a given BitMove.
Simply put, this method will return the Piece
at a move's from square.
Safety
Assumes the move is legal for the current board.
pub fn captured_piece(&self, m: BitMove) -> PieceType
[src]
Returns the piece that was captured, if any from a given BitMove.
If the move is not a capture, PieceType::None
will be returned.
Safety
Assumes the move is legal for the current board.
pub fn key_after(&self, m: BitMove) -> u64
[src]
Returns the Zobrist key after a move is played. Doesn't recognize special moves like castling, en-passant, and promotion.
Safety
Panics if the move is not legal for the current board.
pub fn pretty_string(&self) -> String
[src]
Returns a prettified String of the current Board
, for easy command line displaying.
Capital Letters represent white pieces, while lower case represents black pieces.
pub fn get_piece_locations(&self) -> PieceLocations
[src]
Returns a clone of the current PieceLocations
.
pub fn print_debug_info(&self)
[src]
Get Debug Information.
pub fn pretty_print(&self)
[src]
Prints a prettified representation of the board.
pub fn fancy_print(&self)
[src]
Print the board alongside useful information.
Mostly for Debugging useage.
impl Board
[src]
pub fn is_ok_quick(&self) -> bool
[src]
Checks the basic status of the board, returning false if something is wrong.
pub fn is_okay(&self) -> Result<(), BoardError>
[src]
Checks if the current state of the Board is okay.
Trait Implementations
impl Clone for Board
[src]
fn clone(&self) -> Self
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl PartialEq<Board> for Board
[src]
fn eq(&self, other: &Board) -> bool
[src]
#[must_use]
fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
This method tests for !=
.
impl Default for Board
[src]
impl Display for Board
[src]
impl Debug for Board
[src]
Auto Trait Implementations
Blanket Implementations
impl<T> ToString for T where
T: Display + ?Sized,
[src]
T: Display + ?Sized,
impl<T, U> Into for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From for T
[src]
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T> Borrow for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,