pub struct Engine {
pub attack_table: AttackTable,
}Expand description
The chess engine which has knowledge of the chess rules.
On initialization it generates all static data (like attack tables), so it’s best to only initialize it only once (hence the Arc<>).
Fields§
§attack_table: AttackTableImplementations§
Source§impl Engine
impl Engine
pub fn initialize() -> Arc<Self>
pub fn generate_moves( &self, game_state: &GameState, ) -> (Vec<ChessMove>, GameStatus)
pub fn is_legal_move( &self, game_state: &GameState, chess_move: ChessMove, ) -> bool
pub fn is_in_check(&self, board: ChessBoard, color: Color) -> bool
pub fn is_square_attacked( &self, board: ChessBoard, square: u8, opponent_color: Color, ) -> bool
pub fn get_square_threats( &self, board: ChessBoard, square: u8, opponent_color: Color, ) -> BitBoard
pub fn is_promotion(&self, game_state: &GameState, move_to: u8) -> bool
pub fn get_pawn_double_push_target( &self, game_state: &GameState, from: u8, occupied_mask: BitBoard, ) -> Option<u8>
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Engine
impl RefUnwindSafe for Engine
impl Send for Engine
impl Sync for Engine
impl Unpin for Engine
impl UnsafeUnpin for Engine
impl UnwindSafe for Engine
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more