Trait myopic_board::ChessBoard[][src]

pub trait ChessBoard: Clone + Send {
Show methods fn make(&mut self, action: Move) -> Result<()>;
fn unmake(&mut self) -> Result<Move>;
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 locs(&self, pieces: &[Piece]) -> BitBoard;
fn king(&self, side: Side) -> Square;
fn piece(&self, location: Square) -> Option<Piece>;
fn half_move_clock(&self) -> usize;
fn position_count(&self) -> usize;
fn remaining_rights(&self) -> EnumSet<CastleZone>;
fn play_pgn(&mut self, moves: &str) -> Result<Vec<Move>>;
fn play_uci(&mut self, moves: &str) -> Result<Vec<Move>>;
fn parse_uci(&mut self, uci_move: &str) -> Result<Move>;
fn to_partial_fen(&self, cmps: &[FenComponent]) -> String; fn to_fen(&self) -> String { ... }
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 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.

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.

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.

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.

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

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

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

Return the locations of all pieces on the given side.

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

Return the locations of all white and black pieces.

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

Returns the Zobrist hash of this position.

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

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

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

Return the enpassant target square in this position.

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

Return the locations of the given pieces.

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

Return the location of the king for the given side.

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

Return the piece occupying the given location.

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

Return the half move clock value at this position.

fn position_count(&self) -> usize[src]

Return the number of previous positions for this board.

fn remaining_rights(&self) -> EnumSet<CastleZone>[src]

Return the remaining castling rights from this position.

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.

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.

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.

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

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

Return the complete FEN representation of this position.

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

Returns the locations of all pieces on the board.

Loading content...

Implementors

impl ChessBoard for Board[src]

fn make(&mut self, mv: Move) -> Result<()>[src]

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

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

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

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

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

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

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

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

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

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

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

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

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

fn position_count(&self) -> usize[src]

fn remaining_rights(&self) -> EnumSet<CastleZone>[src]

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

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

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

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

Loading content...