[][src]Trait myopic_board::MutBoard

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

pub fn evolve(&mut self, action: &Move) -> Discards[src]

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.

pub fn devolve(&mut self, action: &Move, discards: Discards)[src]

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.

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

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.

pub fn termination_status(&mut self) -> Option<Termination>[src]

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.

pub fn in_check(&mut self) -> bool[src]

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

pub fn side(&self, side: Side) -> BitBoard[src]

Return the locations of all pieces on the given side.

pub fn sides(&self) -> (BitBoard, BitBoard)[src]

Return the locations of all white and black pieces.

pub fn hash(&self) -> u64[src]

Returns the Zobrist hash of this position.

pub fn active(&self) -> Side[src]

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

pub fn enpassant(&self) -> Option<Square>[src]

Return the enpassant target square in this position.

pub fn castle_status(&self, side: Side) -> Option<CastleZone>[src]

Return the castling status of the given side.

pub fn locs(&self, piece: Piece) -> BitBoard[src]

Return the locations of the given piece.

pub fn king(&self, side: Side) -> Square[src]

Return the location of the king for the given side.

pub fn piece(&self, location: Square) -> Option<Piece>[src]

Return the piece occupying the given location.

pub fn half_move_clock(&self) -> usize[src]

Return the half move clock value at this position.

pub fn history_count(&self) -> usize[src]

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

Loading content...

Provided methods

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

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

pub fn all_pieces(&self) -> BitBoard[src]

Returns the locations of all pieces on the board.

Loading content...

Implementors

impl MutBoard for MutBoardImpl[src]

Loading content...