Rename names for better readability

This commit is contained in:
2024-07-16 20:54:29 +03:00
parent ae95a941a2
commit b24190fd62
6 changed files with 139 additions and 142 deletions

View File

@@ -36,7 +36,7 @@ impl State {
}
}
pub const fn get_en_passant_target_square(&self) -> Option<usize> {
pub const fn en_passant_target_square(&self) -> Option<usize> {
self.en_passant_target_square
}
@@ -47,10 +47,10 @@ impl State {
}
}
pub fn update_castling_state_quiet(&mut self, source: usize, color: Color) {
self.update_castling_state_capture(source, color);
pub fn update_castling_state_quiet(&mut self, src: usize, color: Color) {
self.update_castling_state_capture(src, color);
match (source, color) {
match (src, color) {
(4, Color::White) => self.set_castling_ability(color, Castle::None),
(60, Color::Black) => self.set_castling_ability(color, Castle::None),
_ => (),
@@ -64,7 +64,7 @@ impl State {
};
if target == short_square {
match self.get_castling_ability(color) {
match self.castling_ability(color) {
Castle::Both => self.set_castling_ability(color, Castle::Long),
Castle::Short => self.set_castling_ability(color, Castle::None),
_ => (),
@@ -72,7 +72,7 @@ impl State {
}
if target == long_square {
match self.get_castling_ability(color) {
match self.castling_ability(color) {
Castle::Both => self.set_castling_ability(color, Castle::Short),
Castle::Long => self.set_castling_ability(color, Castle::None),
_ => (),
@@ -91,11 +91,11 @@ impl State {
self.side_to_move
}
pub fn set_en_passant_target_square(&mut self, sq: Option<usize>) {
self.en_passant_target_square = sq;
pub fn set_en_passant_target_square(&mut self, square: Option<usize>) {
self.en_passant_target_square = square;
}
pub const fn get_castling_ability(&self, color: Color) -> Castle {
pub const fn castling_ability(&self, color: Color) -> Castle {
match color {
Color::White => self.castling_ability[0],
Color::Black => self.castling_ability[1],