[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:
Eryn Wells 2024-01-21 10:38:50 -08:00
parent 21b5266789
commit fa1c6b452e
8 changed files with 95 additions and 63 deletions

View file

@ -3,7 +3,7 @@
use crate::{
bitboard::BitBoardBuilder,
piece::{PlacedPiece, Shape},
position::{flags::Flags, piece_sets::PieceBitBoards, BoardSide},
position::{flags::Flags, piece_sets::PieceBitBoards},
r#move::Castle,
square::{Direction, Rank},
BitBoard, Color, MakeMoveError, Move, Piece, Position, Square,
@ -64,22 +64,19 @@ impl Builder {
impl Default for Builder {
fn default() -> Self {
let white_king_square = Square::king_starting_square(Color::White);
let black_king_square = Square::king_starting_square(Color::Black);
let pieces = BTreeMap::from_iter([
(
Square::KING_STARTING_SQUARES[Color::White as usize],
piece!(White King),
),
(
Square::KING_STARTING_SQUARES[Color::Black as usize],
piece!(Black King),
),
(white_king_square, piece!(White King)),
(black_king_square, piece!(Black King)),
]);
Self {
player_to_move: Color::White,
flags: Flags::default(),
pieces: pieces,
kings: Square::KING_STARTING_SQUARES,
kings: [white_king_square, black_king_square],
}
}
}