Commit Graph

65 Commits

Author SHA1 Message Date
Janis 0def756ff0 refactor(tests): NCS-23 improve CommandInvoker tests for clarity and coverage
Build & Test (NowChessSystems) TeamCity build finished
2026-04-06 08:34:44 +02:00
Janis 7dac1a0225 refactor(tests): NCS-23 improve CommandInvoker tests for clarity and coverage
Build & Test (NowChessSystems) TeamCity build failed
2026-04-05 22:45:55 +02:00
Janis d2c22337aa refactor(tests): improve CommandInvoker tests for clarity and coverage
Build & Test (NowChessSystems) TeamCity build failed
2026-04-05 22:44:53 +02:00
Janis 03c3b90d06 refactor(tests): streamline test cases for ApiResponse, Board, GameContext, Piece, and Square 2026-04-05 22:10:13 +02:00
Janis 3cec5b8898 refactor(tests): enhance test coverage for move application and piece movement logic 2026-04-05 22:03:40 +02:00
Janis 4cf39e3e97 refactor(core): enhance castling logic to include rook movement and improve safety checks 2026-04-05 19:17:23 +02:00
Janis 2cd3ea35f6 refactor(tests): improve FEN and PGN parser test cases for clarity and coverage 2026-04-05 18:41:26 +02:00
Janis 08a8778227 refactor(core): optimize castling move logic and enhance move notation methods
Build & Test (NowChessSystems) TeamCity build failed
2026-04-05 17:58:09 +02:00
Janis 0778882db6 refactor(core): simplify castling logic and improve move translation methods
Build & Test (NowChessSystems) TeamCity build failed
2026-04-05 17:48:06 +02:00
Janis 1fc5e43e77 refactor(core): enhance MoveType to support capture flag and update related logic
Build & Test (NowChessSystems) TeamCity build failed
2026-04-05 17:28:56 +02:00
Janis 432385c7b0 refactor(core): replace GameHistory with HistoryMove in PGN export logic 2026-04-05 17:08:54 +02:00
Janis a1b7cc7f4a refactor(core): streamline FEN and PGN export/import methods in ChessBoardView 2026-04-05 17:01:34 +02:00
Janis 17fa13c82a test(core): add GameEngineLoadGameTest for loadGame/exportGame
Add 3 focused tests for GameEngine load/export functionality:
- loadGame with PgnParser validates PGN parsing and undo/redo state
- loadGame with FenParser validates position loading without move replay
- exportGame with PgnExporter validates PGN output

Fix: PgnParser now extends GameContextImport trait for consistency with FenParser.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-05 15:22:04 +02:00
Janis e88f502ffc refactor(core): add loadGame/exportGame, remove loadPgn from GameEngine
- Add imports for GameContextImport and GameContextExport
- Add loadGame(importer, input) method to load game from importer
- Add exportGame(exporter) method to export current game context
- Remove entire loadPgn method (replaced by loadGame)
- Remove GameEngineLoadPgnTest (tests old loadPgn API)

loadGame supports both move replay and direct position loading:
- If no moves, sets position directly via loadPosition
- If moves exist, replays through command system for undo/redo support
- Notifies PgnLoadedEvent on success

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-05 14:51:33 +02:00
Janis fa5cdf4e9c refactor(core): enhance GameEngine and GUI for undo/redo functionality and integrate FEN/PGN export/import
Build & Test (NowChessSystems) TeamCity build failed
2026-04-04 21:02:39 +02:00
Janis 9b3bbfbcb7 refactor(core): integrate Rule module and update GameContext handling 2026-04-04 20:25:20 +02:00
Janis 6def31dd80 refactor(core): add IO module and integrate GameContext import/export traits 2026-04-04 19:50:08 +02:00
Janis c08e5f8c62 refactor(core): migrate GameState to GameContext and update FEN handling
Build & Test (NowChessSystems) TeamCity build failed
2026-04-04 17:55:08 +02:00
Janis 6283db85c0 refactor(core): add tests for GameEngine move notation and event handling
Build & Test (NowChessSystems) TeamCity build failed
2026-04-04 17:36:15 +02:00
Janis 9e5ef5a059 refactor(core): NCS-22 update GameEngine to use GameContext and integrate Rule module
Build & Test (NowChessSystems) TeamCity build failed
2026-04-04 17:11:53 +02:00
Janis 3d9a108bdc refactor(core): NCS-22 update GameEngine to use GameContext and integrate Rule module
Build & Test (NowChessSystems) TeamCity build failed
2026-04-04 17:11:11 +02:00
Janis b184d50265 refactor(core): cleanup UI and notation imports for NCS-22 interface abstraction
Build & Test (NowChessSystems) TeamCity build failed
- Removed unused CastleSide import from PgnExporter
- Updated TerminalUI and GUIObserver to use GameContext
- Temporarily disabled GUI FEN/PGN import-export (requires full rework with GameContext)
- Deleted unused logic files and GameController per spec

Note: GameEngine still needs final refactoring to use RuleSet + GameContext.
Core architecture (api -> rule -> core) is structurally complete.
2026-04-03 17:16:40 +02:00
Janis 2b23b62b74 refactor(core): delete GameController (replaced by GameEngine + RuleSet) 2026-04-03 17:15:44 +02:00
Janis 7516828fb1 refactor(core): remove duplicate logic files (moved to StandardRules) 2026-04-03 17:12:57 +02:00
Janis cd6cce163d refactor(core): remove GameController, update events to GameContext, verify build
Task 6: Updated all GameEvent case classes to use context: GameContext instead of separate board/history/turn
Task 7: Deleted old logic files and restored as compatibility layer in modules/api
Task 8: Verified build - main source compilation succeeds

Changes:
- Updated Observer.scala events: all GameEvent subclasses now accept GameContext
- Restored GameHistory and HistoryMove to modules/api as compatibility types
- Restored logic files (GameRules, MoveValidator, etc.) with updated imports
- Updated GameEngine to use currentContext helper for event creation
- Updated GameController to convert CastleSide to String for HistoryMove
- Updated PgnParser/PgnExporter to work with String representation of castling
- Added modules:rule to settings.gradle.kts for dependency resolution
- All main source code compiles successfully; tests expected to need refactoring

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
2026-04-03 17:10:03 +02:00
Janis 8d9996bfed build: configure rule module and add dependency from core
Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
2026-04-03 13:17:21 +02:00
TeamCity 51ffd7aac9 ci: bump version with Build-28 2026-04-03 09:09:16 +00:00
TeamCity 45013c87a9 ci: bump version with Build-27 2026-04-02 19:15:54 +00:00
Janis 80518719d5 feat: NCS-21 Write Scripts to automate certain tasks (#15)
Build & Test (NowChessSystems) TeamCity build finished
Co-authored-by: shahdlala66 <shahd.lala66@gmail.com>
Reviewed-on: #15
Co-authored-by: Janis <janis.e.20@gmx.de>
Co-committed-by: Janis <janis.e.20@gmx.de>
2026-04-02 21:11:21 +02:00
TeamCity 2d6ead7e47 ci: bump version with Build-26 2026-04-01 20:53:08 +00:00
Janis 3ff80318b4 feat: NCS-17 Implement basic ScalaFX UI (#14)
Build & Test (NowChessSystems) TeamCity build finished
Co-authored-by: shahdlala66 <shahd.lala66@gmail.com>
Reviewed-on: #14
Co-authored-by: Janis <janis.e.20@gmx.de>
Co-committed-by: Janis <janis.e.20@gmx.de>
2026-04-01 22:48:30 +02:00
TeamCity 9fb743d135 ci: bump version with Build-25 2026-04-01 08:40:41 +00:00
lq64 412ed986a9 feat: NCS-11 50-move rule (#9)
Build & Test (NowChessSystems) TeamCity build finished
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

Co-authored-by: LQ63 <lkhermann@web.de>
Reviewed-on: #9
Co-authored-by: Leon Hermann <lq@blackhole.local>
Co-committed-by: Leon Hermann <lq@blackhole.local>
2026-04-01 10:36:24 +02:00
TeamCity 8bbeead702 ci: bump version with Build-24 2026-04-01 07:17:44 +00:00
Janis e5e20c566e fix: update move validation to check for king safety (#13)
Build & Test (NowChessSystems) TeamCity build finished
Reviewed-on: #13
2026-04-01 09:07:06 +02:00
Janis 13bfc16cfe feat: NCS-10 Implement Pawn Promotion (#12)
Build & Test (NowChessSystems) TeamCity build finished
Reviewed-on: #12
Reviewed-by: Leon Hermann <lq@blackhole.local>
Co-authored-by: Janis <janis-e@gmx.de>
Co-committed-by: Janis <janis-e@gmx.de>
2026-03-31 22:18:14 +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
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