[board] Remove BoardSide enum; use Castle everywhere
Move Castle to a castle module inside the move module. Implement into_index() on Castle to turn it into a usize.
This commit is contained in:
parent
21b5266789
commit
fa1c6b452e
8 changed files with 95 additions and 63 deletions
|
@ -1,6 +1,5 @@
|
|||
// Eryn Wells <eryn@erynwells.me>
|
||||
|
||||
use super::position::BoardSide;
|
||||
use crate::{r#move::Castle, Color};
|
||||
use std::fmt;
|
||||
|
||||
|
@ -9,9 +8,8 @@ pub(super) struct Flags(u8);
|
|||
|
||||
impl Flags {
|
||||
#[inline]
|
||||
pub(super) fn player_has_right_to_castle_flag_offset(color: Color, castle: Castle) -> u8 {
|
||||
let board_side: BoardSide = castle.into();
|
||||
((color as u8) << 1) + board_side as u8
|
||||
pub(super) fn player_has_right_to_castle_flag_offset(color: Color, castle: Castle) -> usize {
|
||||
((color as usize) << 1) + castle.into_index()
|
||||
}
|
||||
|
||||
pub(super) fn player_has_right_to_castle(&self, color: Color, castle: Castle) -> bool {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue