feat: NCS-9 En passant implementation #8

Merged
Janis merged 7 commits from feat/NCS-9 into main 2026-03-29 17:06:50 +02:00
Owner
  • Add EnPassantCalculator to derive the en passant target square from GameHistory, detect en passant captures, and
    compute the captured pawn's square

    • Extend MoveValidator.legalTargets to include the en passant diagonal square in pawn legal targets
    • Extend GameController.processMove to remove the captured pawn from the board when an en passant capture is played

    Details

    En passant is derived purely from the last HistoryMove — no new state is introduced. If the last move was a double
    pawn push, the target square is the square the pawn passed through. The board mutation follows the same pattern as
    castling: board.withMove moves the capturing pawn, then board.removed removes the captured pawn from its actual square
    (which differs from the destination square).

    Test Plan

    • EnPassantCalculatorTest — 14 unit tests covering target derivation, captured square calculation, and capture
      detection for both colors
    • MoveValidatorTest — 5 new tests: ep target included/excluded based on history, adjacency filter, both colors, case _
      branch coverage
    • GameControllerTest — 2 integration tests: white and black en passant capture removes pawn from board and returns
      correct captured piece
    • 100% scoverage (line/branch/method) confirmed
- Add EnPassantCalculator to derive the en passant target square from GameHistory, detect en passant captures, and compute the captured pawn's square - Extend MoveValidator.legalTargets to include the en passant diagonal square in pawn legal targets - Extend GameController.processMove to remove the captured pawn from the board when an en passant capture is played Details En passant is derived purely from the last HistoryMove — no new state is introduced. If the last move was a double pawn push, the target square is the square the pawn passed through. The board mutation follows the same pattern as castling: board.withMove moves the capturing pawn, then board.removed removes the captured pawn from its actual square (which differs from the destination square). Test Plan - EnPassantCalculatorTest — 14 unit tests covering target derivation, captured square calculation, and capture detection for both colors - MoveValidatorTest — 5 new tests: ep target included/excluded based on history, adjacency filter, both colors, case _ branch coverage - GameControllerTest — 2 integration tests: white and black en passant capture removes pawn from board and returns correct captured piece - 100% scoverage (line/branch/method) confirmed
Janis added 7 commits 2026-03-29 16:23:51 +02:00
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Implement explicit removal of the captured pawn in en passant captures.
The pawn is located at a different square than the destination (same file
but one rank closer to the player). Use EnPassantCalculator to compute
the capture square and remove it from the board after withMove.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
revert(docs): Removed created docs from claude for en passant
Build & Test (NowChessSystems) TeamCity build finished
9ab1317ece
Removed created docs from claude for en passant and added them in the correct repo
Janis force-pushed feat/NCS-9 from a0d20a9975 to 9ab1317ece 2026-03-29 16:23:51 +02:00 Compare
Janis requested review from Janis 2026-03-29 16:24:01 +02:00
Janis approved these changes 2026-03-29 16:24:52 +02:00
Member

Bitte den PR Namen aktualisieren.

Bitte den PR Namen aktualisieren.
lq64 changed title from feat/NCS-9 to feat/NCS-9: En passant 2026-03-29 16:53:38 +02:00
Janis changed title from feat/NCS-9: En passant to feat: NCS-9 En passant implementation 2026-03-29 17:06:42 +02:00
Janis merged commit 919beb3b4b into main 2026-03-29 17:06:50 +02:00
Janis deleted branch feat/NCS-9 2026-03-29 17:06:50 +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#8