Add halfmove and fullmove clock count
All checks were successful
Python tests (make) / test (push) Successful in 12s

This commit is contained in:
2025-08-23 13:00:28 -04:00
parent 6005741b10
commit 60a987a7a1

View File

@@ -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;