Make more readability refactorings
This commit is contained in:
@@ -4,7 +4,7 @@ use crate::{board::board::Color, movegen::r#move::MoveType};
|
||||
pub struct State {
|
||||
side_to_move: Color,
|
||||
pub castling_ability: [Castle; 2],
|
||||
pub en_passant_target_square: Option<usize>,
|
||||
pub en_passant_square: Option<usize>,
|
||||
pub halfmove_clock: u8,
|
||||
pub fullmove_counter: u8,
|
||||
}
|
||||
@@ -14,7 +14,7 @@ impl State {
|
||||
Self {
|
||||
side_to_move: Color::White,
|
||||
castling_ability: [Castle::Both, Castle::Both],
|
||||
en_passant_target_square: None,
|
||||
en_passant_square: None,
|
||||
halfmove_clock: 0,
|
||||
fullmove_counter: 1,
|
||||
}
|
||||
@@ -23,25 +23,25 @@ impl State {
|
||||
pub const fn load_state(
|
||||
side_to_move: Color,
|
||||
castling_ability: [Castle; 2],
|
||||
en_passant_target_square: Option<usize>,
|
||||
en_passant_square: Option<usize>,
|
||||
halfmove_clock: u8,
|
||||
fullmove_counter: u8,
|
||||
) -> Self {
|
||||
Self {
|
||||
side_to_move,
|
||||
castling_ability,
|
||||
en_passant_target_square,
|
||||
en_passant_square,
|
||||
halfmove_clock,
|
||||
fullmove_counter,
|
||||
}
|
||||
}
|
||||
|
||||
pub const fn en_passant_target_square(&self) -> Option<usize> {
|
||||
self.en_passant_target_square
|
||||
pub const fn en_passant_square(&self) -> Option<usize> {
|
||||
self.en_passant_square
|
||||
}
|
||||
|
||||
pub fn set_en_passant_target_square(&mut self, square: Option<usize>) {
|
||||
self.en_passant_target_square = square;
|
||||
pub fn set_en_passant_square(&mut self, square: Option<usize>) {
|
||||
self.en_passant_square = square;
|
||||
}
|
||||
|
||||
pub const fn castling_ability(&self, color: Color) -> Castle {
|
||||
|
||||
Reference in New Issue
Block a user