Skip to content

feat: implement fifty-move and seventy-five-move draw rules#6

Merged
Mgrdich merged 2 commits intomainfrom
draw-by-moves
Jan 6, 2026
Merged

feat: implement fifty-move and seventy-five-move draw rules#6
Mgrdich merged 2 commits intomainfrom
draw-by-moves

Conversation

@Mgrdich
Copy link
Owner

@Mgrdich Mgrdich commented Jan 6, 2026

No description provided.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This pull request implements the fifty-move and seventy-five-move draw rules according to FIDE chess regulations. The fifty-move rule allows players to claim a draw after 100 half-moves (50 full moves) without a pawn move or capture, while the seventy-five-move rule automatically ends the game in a draw after 150 half-moves (75 full moves) under the same conditions.

Key changes:

  • Added half-move clock management in applyMove() to reset on pawn moves or captures and increment otherwise
  • Implemented draw detection logic in Status() with proper priority ordering (automatic draws before claimable draws)
  • Added comprehensive test coverage for half-move clock behavior and both draw rules

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
internal/engine/board.go Adds half-move clock increment/reset logic in the applyMove() method to track moves for the fifty-move and seventy-five-move rules
internal/engine/game_state.go Updates Status() to detect both draw rules with correct thresholds (100 and 150 half-moves) and priority ordering; updates documentation to reflect completion of the feature
internal/engine/game_state_test.go Adds comprehensive test coverage for half-move clock behavior (increment, reset on pawn moves, captures, en passant, and promotions) and both draw rule scenarios
context/spec/001-chess-engine-foundation/tasks.md Marks Slice 12 tasks as completed

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@Mgrdich Mgrdich merged commit 52f0ebc into main Jan 6, 2026
1 check passed
@Mgrdich Mgrdich deleted the draw-by-moves branch January 6, 2026 12:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants