diff --git a/src/board/chess_board/builder.rs b/src/board/chess_board/builder.rs index d509e67..d16c881 100644 --- a/src/board/chess_board/builder.rs +++ b/src/board/chess_board/builder.rs @@ -8,7 +8,7 @@ pub struct ChessBoardBuilder { // Same fields as [ChessBoard]. castle_rights: [CastleRights; Color::NUM_VARIANTS], en_passant: Option, - half_move_clock: u8, + half_move_clock: u32, side: Color, // 1-based, a turn is *two* half-moves (i.e: both players have played). turn_count: u32, @@ -41,7 +41,7 @@ impl ChessBoardBuilder { self } - pub fn with_half_move_clock(&mut self, clock: u8) -> &mut Self { + pub fn with_half_move_clock(&mut self, clock: u32) -> &mut Self { self.half_move_clock = clock; self } diff --git a/src/board/chess_board/mod.rs b/src/board/chess_board/mod.rs index d28d69c..9ceb673 100644 --- a/src/board/chess_board/mod.rs +++ b/src/board/chess_board/mod.rs @@ -24,7 +24,7 @@ pub struct ChessBoard { /// `Some(target_square)` if a double-step move was made. en_passant: Option, /// The number of half-turns without either a pawn push or capture. - half_move_clock: u8, // Should never go higher than 50. + half_move_clock: u32, // Should *probably* never go higher than 100. /// The number of half-turns so far. total_plies: u32, // Should be plenty. /// The current player turn. @@ -36,7 +36,7 @@ pub struct ChessBoard { pub struct NonReversibleState { castle_rights: [CastleRights; Color::NUM_VARIANTS], en_passant: Option, - half_move_clock: u8, // Should never go higher than 50. + half_move_clock: u32, // Should *probably* never go higher than 100. } impl ChessBoard { @@ -105,7 +105,7 @@ impl ChessBoard { /// Return the number of half-turns without either a pawn push or a capture. #[inline(always)] - pub fn half_move_clock(&self) -> u8 { + pub fn half_move_clock(&self) -> u32 { self.half_move_clock } @@ -214,7 +214,7 @@ impl ChessBoard { } // Make sure the clocks are in agreement. - if u32::from(self.half_move_clock()) > self.total_plies() { + if self.half_move_clock() > self.total_plies() { return Err(InvalidError::HalfMoveClockTooHigh); }