Commit Graph

38 Commits

Author SHA1 Message Date
Janis fc5e18ad3b feat: add tests for completePromotion handling in GameController and GameEngine 2026-03-31 14:30:54 +02:00
Janis 7a06febde8 feat: add promotion handling to GameEngine with pending state and completePromotion()
Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
2026-03-31 14:06:14 +02:00
Janis e6d43be260 feat: add PromotionRequiredEvent to Observer for pawn promotion notification
Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
2026-03-31 14:00:51 +02:00
Janis 2a5755a905 feat: add completePromotion to GameController to finalize promotion moves
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-31 13:40:46 +02:00
Janis 7661aa08f4 test: add field-level assertions to black pawn PromotionRequired test 2026-03-31 13:33:16 +02:00
Janis c6ffd827cb feat: add PromotionRequired to MoveResult and detect promotion in processMove
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-31 13:30:24 +02:00
Janis f0e1ee272d feat: add isPromotionMove detection to MoveValidator
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-31 13:21:06 +02:00
Janis 0800c3af1a feat: extend GameHistory.Move to track promotionPiece
Build & Test (NowChessSystems) TeamCity build failed
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-31 12:50:27 +02:00
TeamCity 85cbf95c18 ci: bump version with Build-22 2026-03-31 08:35:28 +00:00
shosho996 1361dfc895 feat: NCS-16 Core Separation via Patterns (#10)
Build & Test (NowChessSystems) TeamCity build finished
Co-authored-by: Janis <janis-e@gmx.de>
Co-authored-by: shahdlala66 <shahd.lala66@gmail.com>
Co-authored-by: Janis <janis.e.20@gmx.de>
Reviewed-on: #10
Reviewed-by: Janis <janis-e@gmx.de>
Co-authored-by: Shahd Lala <shosho996@blackhole.local>
Co-committed-by: Shahd Lala <shosho996@blackhole.local>
2026-03-31 10:31:02 +02:00
TeamCity 707c4826a4 ci: bump version with Build-21 2026-03-29 15:10:35 +00:00
lq64 919beb3b4b feat: NCS-9 En passant implementation (#8)
Build & Test (NowChessSystems) TeamCity build finished
- 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

Co-authored-by: LQ63 <lkhermann@web.de>
Reviewed-on: #8
Reviewed-by: Janis <janis-e@gmx.de>
Co-authored-by: Leon Hermann <lq@blackhole.local>
Co-committed-by: Leon Hermann <lq@blackhole.local>
2026-03-29 17:06:50 +02:00
TeamCity ee79dc5b98 ci: bump version with Build-20 2026-03-29 12:06:38 +00:00
Janis f28e69dc18 feat: NCS-6 Implementing FEN & PGN (#7)
Build & Test (NowChessSystems) TeamCity build finished
Reviewed-on: #7
Reviewed-by: Leon Hermann <lq@blackhole.local>
2026-03-29 14:02:25 +02:00
TeamCity 5f485fed9b ci: bump version with Build-19 2026-03-28 17:12:54 +00:00
Janis f4c18d22d7 refactor: NCS-8 removed Context and replaced it with History (#6)
Build & Test (NowChessSystems) TeamCity build finished
Reviewed-on: #6
2026-03-28 18:08:55 +01:00
TeamCity 4d800e88eb ci: bump version with Build-18 2026-03-28 12:39:59 +00:00
TeamCity 9190d1e5a0 ci: bump version with v17%
Build & Test (NowChessSystems) TeamCity build finished
2026-03-27 09:25:13 +00:00
Janis d675966436 refactor: replace return/var in castlingTargets with functional style (#4)
Build & Test (NowChessSystems) TeamCity build finished
Reviewed-on: #4
Co-authored-by: Janis <janis.e.20@gmx.de>
Co-committed-by: Janis <janis.e.20@gmx.de>
2026-03-25 08:48:49 +01:00
Janis b4116e9a82 test: add unit tests for API response, board, color, game state, move, piece, and square (#3)
Build & Test (NowChessSystems) TeamCity build finished
Reviewed-on: #3
2026-03-25 08:19:43 +01:00
lq64 00d326c1ba feat: implement legal castling (#1)
Build & Test (NowChessSystems) TeamCity build finished
## Summary

  - Introduces `GameContext` wrapper (board + castling rights) threading through the entire engine pipeline
  - Extends `MoveValidator` with `castlingTargets`, context-aware `legalTargets`/`isLegal` overloads, and helpers (`isCastle`, `castleSide`)
  - Updates `GameRules.legalMoves` and `gameStatus` to use `GameContext`, preventing false stalemate when castling is the only legal move
  - Adds castle detection and atomic execution (`withCastle`) to `GameController.processMove`, plus full rights revocation via source- and
  destination-square tables

  ## Test Plan

  - [ ] 142 tests passing, 100% statement and branch coverage on `modules/core`
  - [ ] White/Black kingside (e1g1/e8g8) and queenside (e1c1/e8c8) castling moves execute correctly
  - [ ] All six legality conditions enforced (rights flags, home squares, empty transit, king not in check, transit/landing squares not attacked)
  - [ ] Rights revoked on king moves, own rook moves, castle moves, and enemy rook captures
  - [ ] False stalemate correctly prevented when castling is the only escape

Co-authored-by: LQ63 <lkhermann@web.de>
Co-authored-by: Janis <janis.e.20@gmx.de>
Reviewed-on: #1
Reviewed-by: Janis <janis-e@gmx.de>
Co-authored-by: Leon Hermann <lq@blackhole.local>
Co-committed-by: Leon Hermann <lq@blackhole.local>
2026-03-24 17:55:00 +01:00
Janis 7b1f8b1176 fix: update main class path in build configuration and adjust VCS directory mapping
Build & Test (NowChessSystems) TeamCity build finished
2026-03-24 09:59:13 +01:00
Janis aedd787b77 fix: add missing kings to gameLoop capture test board 2026-03-23 22:37:15 +01:00
Janis f0481e2561 fix: correct test board positions and captureOutput/withInput interaction
- Add BlackKing/WhiteKing to capture board in 'legal capture returns Moved'
  so the position is not treated as stalemate after the capture.
- Move WhiteKing from A3 to C3 in three MovedInCheck tests so it no
  longer blocks the rook's path along file A.
- Remove Console.withOut(System.out) from withInput so it no longer
  overrides the ByteArrayOutputStream installed by captureOutput.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-23 22:32:51 +01:00
Janis 5264a22541 feat: wire check/checkmate/stalemate into processMove and gameLoop
Replace stub branches with GameRules.gameStatus dispatch in processMove
and fill in MovedInCheck/Checkmate/Stalemate cases in gameLoop.
Document 6 pre-existing test bugs in docs/unresolved.md.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-23 22:30:09 +01:00
Janis 13ac90a42f test: add failing GameControllerTest cases for check/checkmate/stalemate
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-23 22:16:53 +01:00
Janis 8b7ec57e5e feat: add MovedInCheck/Checkmate/Stalemate MoveResult variants (stub dispatch)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-23 21:48:32 +01:00
Janis 94a02ff684 feat: implement GameRules with isInCheck, legalMoves, gameStatus
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-23 21:42:21 +01:00
Janis 86552b52bd test: add failing GameRulesTest for check/checkmate/stalemate
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-23 21:34:24 +01:00
Janis 76d4168038 feat: add GameRules stub with PositionStatus enum 2026-03-23 21:29:41 +01:00
Janis fe39d27d91 test: add unit test for clean exit on 'quit' command in Main 2026-03-22 15:31:02 +01:00
Janis 551e08cef3 build: migrate to ScalaTest and Scoverage, replacing JaCoCo across modules 2026-03-22 15:28:02 +01:00
Janis 5a21e57ca9 chore: Update build configuration for Scoverage and ScalaTest integration 2026-03-22 14:19:44 +01:00
Janis 51b210e9eb chore: Update documentation and improve test writing guidelines 2026-03-22 11:47:20 +01:00
Janis a8abd69e0e chore: Add initial implementation of move validation logic and game controller 2026-03-21 21:26:37 +01:00
Janis 1f1d3b670f chore: Refactor chess logic to MVC pattern and enhance board representation 2026-03-21 20:37:33 +01:00
Janis 9c2456e928 chore: Set up shared-models library and initial project structure for NowChessSystems 2026-03-21 17:07:28 +01:00
Janis a8d457a612 chore: Configure Scala build with dependencies and project structure 2026-03-21 15:52:51 +01:00