From 60a987a7a1636c8e2f17dd6c869bba9764ee129a Mon Sep 17 00:00:00 2001 From: Josh Date: Sat, 23 Aug 2025 13:00:28 -0400 Subject: [PATCH] Add halfmove and fullmove clock count --- engine/src/bitboard.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/engine/src/bitboard.c b/engine/src/bitboard.c index bc7ba41..31ac845 100644 --- a/engine/src/bitboard.c +++ b/engine/src/bitboard.c @@ -715,6 +715,14 @@ bool apply_move_on_copy(struct Board *in, struct Board *out, struct Move m) { in->castling_rights, m.piece, m.from, m.to, captured_pid ); + + // Apply full and half move clock counts. + bool is_capture = (m.flags & MF_CAPTURE) || (m.flags & MF_ENPASSANT); + bool is_pawn = (m.piece == P) || (m.piece == p); + + out->halfmove_clock = (is_capture || is_pawn) ? 0 : in->halfmove_clock + 1; + out->fullmove_number = in->fullmove_number + (in->side_to_move == BLACK); + // Side to move flips out->side_to_move = opp;