feat: NCS-11 50-move rule #9

Merged
Janis merged 12 commits from feat/NCS-11 into main 2026-04-01 10:36:24 +02:00
Owner

Summary

  • Implements the FIDE 50-move draw rule: a player may claim a draw if no pawn move or capture has occurred in the last
    50 full moves (100 half-moves)
  • Draw is not automatic — the eligible player must claim it via a TUI menu shown at the start of their turn
  • halfMoveClock: Int is threaded through processMove and gameLoop; resets on pawn move, capture, or en passant;
    increments on all other moves

Changes

  • GameController.scala: extended MoveResult.Moved and MoveResult.MovedInCheck with newHalfMoveClock: Int; added
    MoveResult.DrawClaimed; added halfMoveClock parameter to processMove and gameLoop; TUI menu shown when clock ≥ 100
  • Main.scala: initial gameLoop call passes halfMoveClock = 0
  • GameControllerTest.scala: updated all existing pattern matches; added 10 new tests covering clock reset, clock
    increment, draw claim, and TUI menu behaviour

Test plan

  • processMove: 'draw' with halfMoveClock = 100 → DrawClaimed
  • processMove: 'draw' with halfMoveClock = 99 → InvalidFormat
  • Pawn move / capture / en passant → clock resets to 0
  • Quiet piece move → clock increments by 1
  • MovedInCheck carries updated clock
  • TUI menu appears when clock ≥ 100; option 1 claims draw, option 2 continues
  • No TUI menu when clock < 100
  • All 197 tests passing
Summary - Implements the FIDE 50-move draw rule: a player may claim a draw if no pawn move or capture has occurred in the last 50 full moves (100 half-moves) - Draw is not automatic — the eligible player must claim it via a TUI menu shown at the start of their turn - halfMoveClock: Int is threaded through processMove and gameLoop; resets on pawn move, capture, or en passant; increments on all other moves Changes - GameController.scala: extended MoveResult.Moved and MoveResult.MovedInCheck with newHalfMoveClock: Int; added MoveResult.DrawClaimed; added halfMoveClock parameter to processMove and gameLoop; TUI menu shown when clock ≥ 100 - Main.scala: initial gameLoop call passes halfMoveClock = 0 - GameControllerTest.scala: updated all existing pattern matches; added 10 new tests covering clock reset, clock increment, draw claim, and TUI menu behaviour Test plan - processMove: 'draw' with halfMoveClock = 100 → DrawClaimed - processMove: 'draw' with halfMoveClock = 99 → InvalidFormat - Pawn move / capture / en passant → clock resets to 0 - Quiet piece move → clock increments by 1 - MovedInCheck carries updated clock - TUI menu appears when clock ≥ 100; option 1 claims draw, option 2 continues - No TUI menu when clock < 100 - All 197 tests passing
lq64 closed this pull request 2026-03-30 14:49:52 +02:00
lq64 reopened this pull request 2026-03-30 14:55:48 +02:00
Member

Needs refactoring as soon as the core seperation is completed

Needs refactoring as soon as the core seperation is completed
Janis added 11 commits 2026-04-01 10:20:45 +02:00
Janis force-pushed feat/NCS-11 from 88758c1cd1 to c8ea043ccc 2026-04-01 10:20:45 +02:00 Compare
lq64 added 1 commit 2026-04-01 10:33:04 +02:00
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Janis merged commit 412ed986a9 into main 2026-04-01 10:36:24 +02:00
Janis deleted branch feat/NCS-11 2026-04-01 10:36:24 +02:00
Sign in to join this conversation.
No Reviewers
No Label
2 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: NowChess/NowChessSystems#9