[][src]Struct pleco::board::board_state::BoardState

pub struct BoardState {
    pub castling: Castling,
    pub rule_50: i16,
    pub ply: u16,
    pub ep_square: SQ,
    pub psq: Score,
    pub zobrist: u64,
    pub pawn_key: u64,
    pub material_key: u64,
    pub nonpawn_material: [Value; 2],
    pub captured_piece: PieceType,
    pub checkers_bb: BitBoard,
    pub blockers_king: [BitBoard; 2],
    pub pinners_king: [BitBoard; 2],
    pub check_sqs: [BitBoard; 8],
    pub prev_move: BitMove,
    pub prev: Option<Arc<BoardState>>,
}

Holds useful information concerning the current state of the Board.

This is information that is computed upon making a move, and requires expensive computation to do so as well. It is stored in the Heap by Board as an Arc<BoardState>, as cloning the board can lead to multiple references to the same BoardState.

Allows for easy undo-ing of moves as these keep track of their previous board state, forming a Tree-like persistent Stack.

Fields

castling: Castling

The castling rights for the current board.

rule_50: i16

Rule 50 for the current board. Tracks the moves since a capture, pawn move, or castle.

ply: u16

Returns how many plies deep the current Board is. In simpler terms, how many moves have been played since the Board was created.

ep_square: SQ

If the last move was a double pawn push, this will be equal to the square behind. the push. So, ep_square = abs(sq_to - sq_from) / 2. If the last move was not a double pawn push, then ep_square = NO_SQ.

psq: Score

The positional score of the board.

zobrist: u64

The Zobrist key of the board.

pawn_key: u64

The Hash key of the current pawn configuration.

material_key: u64

The Hash key of the current material configuration.

nonpawn_material: [Value; 2]

The value of each player's non-pawn pieces.

captured_piece: PieceType

The last captured Piece, if any.

checkers_bb: BitBoard

A BitBoard of the current pieces giving check.

blockers_king: [BitBoard; 2]

Per each player, BitBoard of pieces blocking an attack on a that player's king. This field can contain opponents pieces. E.g. a Black Pawn can block an attack of a white king if there is a queen (or some other sliding piece) on the same line.

pinners_king: [BitBoard; 2]

Per each player, BitBoard of pieces currently pinning the opponent's king.

check_sqs: [BitBoard; 8]

Array of BitBoards where for Each Piece, gives a spot the piece can move to where the opposing player's king would be in check.

prev_move: BitMove

The previous move, if any, that was played. Returns BitMove::NULL if there was no previous move played.

prev: Option<Arc<BoardState>>

Previous State of the board (from one move ago).

Methods

impl BoardState[src]

pub const fn blank() -> BoardState[src]

Constructs a blank BoardState.

pub fn partial_clone(&self) -> BoardState[src]

Constructs a partial clone of a BoardState.

Castling, rule_50, ply, and ep_square are copied. The copied fields need to be modified accordingly, and the remaining fields need to be generated.

pub fn get_prev(&self) -> Option<Arc<BoardState>>[src]

Return the previous BoardState from one move ago.

If there was no previous state, returns None.

pub fn backtrace(&self)[src]

Iterates through all previous BoardStates and prints debug information for each.

Used primarily for debugging.

pub fn print_info(&self)[src]

Prints information about the current BoardState.

Trait Implementations

impl PartialEq<BoardState> for BoardState[src]

#[must_use]
fn ne(&self, other: &Rhs) -> bool
1.0.0
[src]

This method tests for !=.

impl Clone for BoardState[src]

fn clone_from(&mut self, source: &Self)
1.0.0
[src]

Performs copy-assignment from source. Read more

Auto Trait Implementations

impl Send for BoardState

impl Sync for BoardState

Blanket Implementations

impl<T, U> Into for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> From for T[src]

impl<T, U> TryFrom for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T> Borrow for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> BorrowMut for T where
    T: ?Sized
[src]

impl<T, U> TryInto for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.