diff --git a/position/src/position/position.rs b/position/src/position/position.rs index 75b4b79..774fc26 100644 --- a/position/src/position/position.rs +++ b/position/src/position/position.rs @@ -26,16 +26,7 @@ pub struct Position { impl Position { pub fn empty() -> Position { - Position { - color_to_move: Color::White, - flags: Default::default(), - pieces: PieceBitBoards::default(), - en_passant_square: None, - sight: [OnceCell::new(), OnceCell::new()], - moves: OnceCell::new(), - half_move_counter: 0, - full_move_number: 1, - } + Default::default() } /// Return a starting position. @@ -60,13 +51,8 @@ impl Position { Self { color_to_move: Color::White, - flags: Flags::default(), pieces: PieceBitBoards::new([white_pieces, black_pieces]), - en_passant_square: None, - sight: [OnceCell::new(), OnceCell::new()], - moves: OnceCell::new(), - half_move_counter: 0, - full_move_number: 1, + ..Default::default() } } @@ -340,7 +326,16 @@ impl Position { impl Default for Position { fn default() -> Self { - Self::empty() + Self { + color_to_move: Color::White, + flags: Flags::default(), + pieces: PieceBitBoards::default(), + en_passant_square: None, + sight: [OnceCell::new(), OnceCell::new()], + moves: OnceCell::new(), + half_move_counter: 0, + full_move_number: 1, + } } }