pub struct MoveInfo {
pub halfmove_clock: u32,
pub fullmove_number: u32,
pub en_passant: Option<Position>,
pub castling_rights: u8,
pub game_status: GameStatus,
pub prev_positions: HashMap<String, u32>,
}Expand description
Represents the information of a Move
Fields§
§halfmove_clock: u32The number of halfmoves since the last capture or pawn move
fullmove_number: u32The number of fullmoves
en_passant: Option<Position>The en passant target square
castling_rights: u8The castling rights
game_status: GameStatusThe status of the Game
prev_positions: HashMap<String, u32>A map of previous board positions and their occurrence counts
Implementations§
Source§impl MoveInfo
impl MoveInfo
Sourcepub fn new(
halfmove_clock: u32,
fullmove_number: u32,
en_passant: Option<Position>,
castling_rights: u8,
game_status: GameStatus,
prev_positions: HashMap<String, u32>,
) -> MoveInfo
pub fn new( halfmove_clock: u32, fullmove_number: u32, en_passant: Option<Position>, castling_rights: u8, game_status: GameStatus, prev_positions: HashMap<String, u32>, ) -> MoveInfo
Creates a new MoveInfo
§Arguments
halfmove_clock: The number of halfmoves since the last capture or pawn movefullmove_number: The number of fullmovesen_passant: The en passant target squarecastling_rights: The castling rightsgame_status: The current GameStatus
§Example
use chess_lab::core::{GameStatus, MoveInfo};
use std::collections::HashMap;
let move_info = MoveInfo::new(0, 1, None, 0, GameStatus::InProgress, HashMap::new());
assert_eq!(move_info.halfmove_clock, 0);
assert_eq!(move_info.fullmove_number, 1);
assert_eq!(move_info.en_passant, None);
assert_eq!(move_info.castling_rights, 0);
assert_eq!(move_info.game_status, GameStatus::InProgress);
assert_eq!(move_info.prev_positions.len(), 0);Trait Implementations§
impl Eq for MoveInfo
impl StructuralPartialEq for MoveInfo
Auto Trait Implementations§
impl Freeze for MoveInfo
impl RefUnwindSafe for MoveInfo
impl Send for MoveInfo
impl Sync for MoveInfo
impl Unpin for MoveInfo
impl UnsafeUnpin for MoveInfo
impl UnwindSafe for MoveInfo
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