[][src]Trait myopic_board::MutBoard

pub trait MutBoard: Clone + Send + Reflectable {
    fn evolve(&mut self, action: &Move) -> Discards;
fn devolve(&mut self, action: &Move, discards: Discards);
fn compute_moves(&mut self, computation_type: MoveComputeType) -> Vec<Move>;
fn termination_status(&mut self) -> Option<Termination>;
fn in_check(&mut self) -> bool;
fn side(&self, side: Side) -> BitBoard;
fn sides(&self) -> (BitBoard, BitBoard);
fn hash(&self) -> u64;
fn active(&self) -> Side;
fn enpassant(&self) -> Option<Square>;
fn castle_status(&self, side: Side) -> Option<CastleZone>;
fn locs(&self, piece: Piece) -> BitBoard;
fn king(&self, side: Side) -> Square;
fn piece(&self, location: Square) -> Option<Piece>;
fn half_move_clock(&self) -> usize;
fn history_count(&self) -> usize; fn locs_n(&self, pieces: &[Piece]) -> BitBoard { ... }
fn all_pieces(&self) -> BitBoard { ... } }

Trait representing a mutable state of play of a chess game which can be evolved/devolved via (applicable) Move instances, compute the set of legal moves and queried for a variety of properties.

Required methods

fn evolve(&mut self, action: &Move) -> Discards

Evolves this board in place according to the given move reference. The move must be one that is legal in this position otherwise the results are undefined. The data which is lost during this evolution is returned at the end of the procedure allowing for devolution to take place.

fn devolve(&mut self, action: &Move, discards: Discards)

Reverses the given move, i.e. it devolves the board. It can only be called after the same move has been used to evolve the board. The discarded information produced by the evolve call must be provided here. If any of these conditions are not met the results of this procedure are undefined.

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.

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.

fn in_check(&mut self) -> bool

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

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

Return the locations of all pieces on the given side.

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

Return the locations of all white and black pieces.

fn hash(&self) -> u64

Returns the Zobrist hash of this position.

fn active(&self) -> Side

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

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

Return the enpassant target square in this position.

fn castle_status(&self, side: Side) -> Option<CastleZone>

Return the castling status of the given side.

fn locs(&self, piece: Piece) -> BitBoard

Return the locations of the given piece.

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

Return the location of the king for the given side.

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

Return the piece occupying the given location.

fn half_move_clock(&self) -> usize

Return the half move clock value at this position.

fn history_count(&self) -> usize

Return the total number of half moves played to reach this position.

Loading content...

Provided methods

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

Returns the locations of a set of pieces as a single bitboard.

fn all_pieces(&self) -> BitBoard

Returns the locations of all pieces on the board.

Loading content...

Implementors

impl MutBoard for MutBoardImpl[src]

Loading content...