pub trait Variant {
Show 20 methods
// Required methods
fn move_piece(&mut self, move_str: &str) -> Result<GameStatus, MoveError>;
fn undo(&mut self);
fn redo(&mut self);
fn pgn(&self) -> String;
fn fen(&self) -> String;
fn get_piece_at(&self, pos: Position) -> Option<Piece>;
fn get_legal_moves(&self, pos: Position) -> Vec<Move>;
fn save(&self, path: &str, overwrite: bool) -> Result<(), Error>;
fn resign(&mut self, color: Color);
fn draw(&mut self);
fn lost_on_time(&mut self, color: Color);
fn get_minified_fen(&self) -> String;
fn get_last_move(&self) -> Option<Move>;
fn is_white_turn(&self) -> bool;
fn get_halfmove_clock(&self) -> u32;
fn get_fullmove_number(&self) -> u32;
fn get_castling_rights(&self) -> String;
fn get_en_passant(&self) -> Option<Position>;
fn get_starting_fen(&self) -> String;
fn get_status(&self) -> GameStatus;
}Expand description
A trait for a chess variant.
A chess variant is a game that is derived from chess, but has different rules.
Required Methods§
Sourcefn move_piece(&mut self, move_str: &str) -> Result<GameStatus, MoveError>
fn move_piece(&mut self, move_str: &str) -> Result<GameStatus, MoveError>
Sourcefn get_piece_at(&self, pos: Position) -> Option<Piece>
fn get_piece_at(&self, pos: Position) -> Option<Piece>
Sourcefn get_legal_moves(&self, pos: Position) -> Vec<Move>
fn get_legal_moves(&self, pos: Position) -> Vec<Move>
Sourcefn lost_on_time(&mut self, color: Color)
fn lost_on_time(&mut self, color: Color)
Sets the game as lost in time for a player.
§Arguments
color- The color of the player that lost in time.