EvalBoard

Struct EvalBoard 

Source
pub struct EvalBoard<B: ChessBoard> { /* private fields */ }

Implementations§

Source§

impl EvalBoard<Board>

Source

pub fn start() -> EvalBoard<Board>

Source

pub fn builder_fen(fen: &str) -> Result<Builder<Board>>

Source§

impl<B> EvalBoard<B>
where B: ChessBoard,

Source

pub fn builder(board: B) -> Builder<B>

Trait Implementations§

Source§

impl<B: ChessBoard> ChessBoard for EvalBoard<B>

Source§

fn make(&mut self, action: Move) -> Result<()>

Evolves the position by making the given move. If the source hash of the move does not match the hash of this position (prior to making the move) then an error will be returned. If the hash matches but the move is illegal in this position (e.g if you manually start creating moves) then the results are undefined.
Source§

fn unmake(&mut self) -> Result<Move>

Reverses and returns the move which was made last. If no move has been made yet then an error is returned.
Source§

fn compute_moves(&mut self, computation_type: MoveComputeType) -> Vec<Move>

Compute a vector of all the legal moves in this position for the given computation type. Note there is no particular ordering to the move vector.
Source§

fn termination_status(&mut self) -> Option<Termination>

Compute the termination state of this node. If it is not terminal nothing is returned, if it is then the manner of termination is returned wrapped inside an Option. The termination can be only a draw or a loss since a side only loses when it runs out of moves, i.e. you don’t play a winning move, you just fail to have a legal move.
Source§

fn in_check(&mut self) -> bool

Determines whether the active side is in a state of check.
Source§

fn side(&self, side: Side) -> BitBoard

Return the locations of all pieces on the given side.
Source§

fn sides(&self) -> (BitBoard, BitBoard)

Return the locations of all white and black pieces.
Source§

fn hash(&self) -> u64

Returns the Zobrist hash of this position.
Source§

fn active(&self) -> Side

Return the active side in this position, i.e. the one whose turn it is.
Source§

fn enpassant(&self) -> Option<Square>

Return the enpassant target square in this position.
Source§

fn locs(&self, pieces: &[Piece]) -> BitBoard

Return the locations of the given pieces.
Source§

fn king(&self, side: Side) -> Square

Return the location of the king for the given side.
Source§

fn piece(&self, location: Square) -> Option<Piece>

Return the piece occupying the given location.
Source§

fn half_move_clock(&self) -> usize

Return the half move clock value at this position.
Source§

fn position_count(&self) -> usize

Return the number of previous positions for this board.
Source§

fn remaining_rights(&self) -> EnumSet<CastleZone>

Return the remaining castling rights from this position.
Source§

fn play_pgn(&mut self, moves: &str) -> Result<Vec<Move>>

Parse the given string as a sequence of pgn encoded moves starting from the current position. The moves are then made one by one. The sequence of moves which were made are returned in a Vec.
Source§

fn play_uci(&mut self, moves: &str) -> Result<Vec<Move>>

Parse the given string as a sequence of uci encoded moves starting from the current position. The moves are then made one by one.The sequence of moves which were made are returned in a Vec.
Source§

fn parse_uci(&mut self, uci_move: &str) -> Result<Move>

Given a uci encoded move this method will attempt to match it to the unique matching legal move in this position if it exist. An error is returned if no matching move exists in this position.
Source§

fn to_partial_fen(&self, cmps: &[FenComponent]) -> String

Return the specified components of the FEN encoding of this position in the given order with components separated by a space.
Source§

fn to_fen(&self) -> String

Return the complete FEN representation of this position.
Source§

fn all_pieces(&self) -> BitBoard

Returns the locations of all pieces on the board.
Source§

impl<B: Clone + ChessBoard> Clone for EvalBoard<B>

Source§

fn clone(&self) -> EvalBoard<B>

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<B: ChessBoard> EvalChessBoard for EvalBoard<B>

Source§

fn static_eval(&mut self) -> i32

The static evaluation function assigns a score to this exact position at the point of time it is called. It does not take into account potential captures/recaptures etc. It must follow the rule that ‘a higher score is best for the active side’. That is if it is white to move next then a high positive score indicates a favorable position for white and if it is black to move a high positive score indicates a favorable position for black. If the state it terminal it must return the LOSS_VALUE or DRAW_VALUE depending on the type of termination.
Source§

fn piece_values(&self) -> &[i32; 6]

The value each piece is considered to have in the current state of the game.
Source§

fn positional_eval(&self, piece: Piece, location: Square) -> i32

The positional (table) value of the given piece situated at the given square in the context of this position.

Auto Trait Implementations§

§

impl<B> Freeze for EvalBoard<B>
where B: Freeze,

§

impl<B> RefUnwindSafe for EvalBoard<B>
where B: RefUnwindSafe,

§

impl<B> Send for EvalBoard<B>

§

impl<B> Sync for EvalBoard<B>
where B: Sync,

§

impl<B> Unpin for EvalBoard<B>
where B: Unpin,

§

impl<B> UnwindSafe for EvalBoard<B>
where B: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.