ChessEngine

Trait ChessEngine 

Source
pub trait ChessEngine {
    // Required methods
    fn current_mapping(&self) -> &PieceMapping;
    fn current_occupied(&self) -> Occupied;
    fn current_captured_bits(&self) -> CapturedBits;
    fn side_to_move(&self) -> Color;
    fn en_passant_target(&self) -> Option<u8>;
    fn ply(&self) -> usize;
    fn game_result(&self) -> GameResult;
    fn read_ply(&self, i: usize) -> Move10;
    fn generate_pseudo_legal_moves(&self) -> Vec<Move10>;
    fn push_move(&mut self, mv: Move10) -> Result<(), MoveError>;
    fn pop_move(&mut self);
    fn reset(&mut self);
}
Expand description

The minimal interface a chess engine must provide.

Required Methods§

Source

fn current_mapping(&self) -> &PieceMapping

Get the current PieceMapping (which piece sits on which square).

Source

fn current_occupied(&self) -> Occupied

Get the current occupancy bitboard.

Source

fn current_captured_bits(&self) -> CapturedBits

Get the current captured‐bits mask.

Source

fn side_to_move(&self) -> Color

Return side to move: White or Black.

Source

fn en_passant_target(&self) -> Option<u8>

Return the current en_passant_target if any.

Source

fn ply(&self) -> usize

Return the number of plies played so far (0..=128).

Source

fn game_result(&self) -> GameResult

Return GameResult (Checkmate/Stalemate/Ongoing).

Source

fn read_ply(&self, i: usize) -> Move10

Return the Move10 code stored at ply index i (0..ply−1).

Generate all pseudo‐legal moves (Move10) for side_to_move, ignoring self‐check.

Source

fn push_move(&mut self, mv: Move10) -> Result<(), MoveError>

Push a move onto the stack. Returns Ok(()) if move is legal and does not leave king in check. Otherwise returns Err(MoveError).

Source

fn pop_move(&mut self)

Pop (undo) the last half‐move, if any.

Source

fn reset(&mut self)

Reset to the starting position (also clears all bit‐planes).

Implementors§