[][src]Trait myopic_board::ChessBoard

pub trait ChessBoard: Clone + Send {
    pub fn make(&mut self, action: Move) -> Result<()>;
pub fn unmake(&mut self) -> Result<Move>;
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, pieces: &[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 position_count(&self) -> usize;
pub fn previous_moves(&self) -> Vec<Move>;
pub fn remaining_rights(&self) -> CastleZoneSet;
pub fn play_pgn(&mut self, moves: &str) -> Result<Vec<Move>>;
pub fn play_uci(&mut self, moves: &str) -> Result<Vec<Move>>;
pub fn parse_uci(&mut self, uci_move: &str) -> Result<Move>;
pub fn to_partial_fen(&self, cmps: &[FenComponent]) -> String; pub fn to_fen(&self) -> String { ... }
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 make(&mut self, action: Move) -> Result<()>[src]

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.

pub fn unmake(&mut self) -> Result<Move>[src]

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

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, pieces: &[Piece]) -> BitBoard[src]

Return the locations of the given pieces.

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 position_count(&self) -> usize[src]

Return the number of previous positions for this board.

pub fn previous_moves(&self) -> Vec<Move>[src]

Return the previous moves played to reach this current position.

pub fn remaining_rights(&self) -> CastleZoneSet[src]

Return the remaining castling rights from this position.

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

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.

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

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.

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

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.

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

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

Loading content...

Provided methods

pub fn to_fen(&self) -> String[src]

Return the complete FEN representation of this position.

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

Returns the locations of all pieces on the board.

Loading content...

Implementors

impl ChessBoard for Board[src]

Loading content...