feat: implement legal castling #1

Merged
Janis merged 12 commits from castling into main 2026-03-24 17:55:01 +01:00

12 Commits

Author SHA1 Message Date
Janis 4a7813f4ff chore: Merge remote-tracking branch 'origin/main' into castling
Build & Test (NowChessSystems) TeamCity build finished
2026-03-24 17:45:58 +01:00
LQ63 b0141d2c89 feat: add castling rights revocation to processMove
Build & Test (NowChessSystems) TeamCity build finished
Introduces applyRightsRevocation helper that revokes rights on castle
moves, king/rook departures from home squares, and enemy captures on
rook home squares. Six new tests verify all revocation paths.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-24 16:43:28 +01:00
LQ63 150e78e080 feat: add castling execution to processMove
Detect castle moves via MoveValidator.isCastle and dispatch to
Board.withCastle so both king and rook are moved atomically.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-24 16:28:48 +01:00
LQ63 62e180c6d9 refactor: migrate GameController to GameContext (signatures only)
Build & Test (NowChessSystems) TeamCity build finished
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-24 13:04:57 +01:00
LQ63 c9a59d3ad1 feat: migrate GameRules.gameStatus to GameContext; add false-stalemate test
- gameStatus now accepts GameContext instead of Board so legalMoves
  (which already requires GameContext for castling) is called directly
  without discarding castling rights
- All four existing gameStatus call sites in GameRulesTest migrated to ctx(...)
- New test: castling as sole legal move returns Normal, not Drawn
- GameController.processMove updated to wrap newBoard in GameContext at
  the gameStatus call site (full ctx propagation deferred to Task 6)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-24 12:59:10 +01:00
LQ63 417a475d84 feat: include castling moves in GameRules.legalMoves
Switch legalMoves to the context-aware MoveValidator.legalTargets(ctx, from)
so castling destinations are included, and simulate castle moves via withCastle
when filtering for self-check.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-24 12:55:00 +01:00
LQ63 7c568581a7 refactor: migrate GameRules.legalMoves signature to GameContext
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-24 12:51:14 +01:00
LQ63 ffe663a62e feat: add castling logic to MoveValidator (castlingTargets + context-aware overloads)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-24 12:44:51 +01:00
LQ63 3c8297e1c3 feat: add GameContext, CastleSide, and Board.withCastle
Introduces GameContext (board + per-side CastlingRights), CastleSide enum,
and a Board.withCastle extension method. Also pins missing verification
checksums for com.fasterxml:oss-parent:41 and org.junit:junit-bom:5.9.2.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-24 12:31:01 +01:00
LQ63 38a68549f5 docs: add castling implementation plan (TDD, 9 tasks)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-24 11:07:51 +01:00
LQ63 205ade8d88 docs: update castling design spec (rev 2 — spec review fixes)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-24 10:47:26 +01:00
LQ63 b6ab8ed6ac docs: add castling design spec
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-24 10:39:03 +01:00