Add State struct as part of Board struct
This commit is contained in:
@@ -7,14 +7,12 @@ use String as FenError;
|
||||
#[derive(Debug, PartialEq, Eq)]
|
||||
pub struct Game {
|
||||
pub board: Board,
|
||||
pub state: State,
|
||||
}
|
||||
|
||||
impl Game {
|
||||
pub const fn new() -> Self {
|
||||
Self {
|
||||
board: Board::new(),
|
||||
state: State::new(),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -33,7 +31,7 @@ impl Default for Game {
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Eq)]
|
||||
#[derive(Debug, PartialEq, Eq, Clone, Copy)]
|
||||
pub struct State {
|
||||
side_to_move: Color,
|
||||
castling_ability: u8,
|
||||
@@ -68,6 +66,10 @@ impl State {
|
||||
fullmove_counter,
|
||||
}
|
||||
}
|
||||
|
||||
pub const fn get_en_passant_target_square(&self) -> u8 {
|
||||
self.en_passant_target_square
|
||||
}
|
||||
}
|
||||
|
||||
use std::fmt;
|
||||
|
||||
Reference in New Issue
Block a user