fix(pgn): add SAN disambiguation and check/checkmate suffixes [NCS-42] #56

Merged
Janis merged 1 commits from worktree-fix-NCS-42 into main 2026-06-02 11:24:28 +02:00
Member

Two bugs in move notation causing PGN import failures in LiChess:

  1. Disambiguation: when two pieces of same type can reach same square,
    SAN requires file/rank/full-square prefix (e.g. "Ndf3" not "Nf3").
    Added disambiguate() in PgnExporter and disambiguatePiece() in
    GameEngine, both querying allLegalMoves to find competing pieces.

  2. Check/checkmate suffix: "+" and "#" were never appended.
    PgnExporter now threads ctxAfter through moveToAlgebraic and
    calls DefaultRules.isCheck/isCheckmate. GameEngine passes
    PostMoveStatus to translateMoveToNotation for the same result.

Also removes dead notation code in executeMoveBody (result was never
used — not passed to MoveExecutedEvent).

Co-Authored-By: Claude Sonnet 4.6 noreply@anthropic.com

Two bugs in move notation causing PGN import failures in LiChess: 1. Disambiguation: when two pieces of same type can reach same square, SAN requires file/rank/full-square prefix (e.g. "Ndf3" not "Nf3"). Added disambiguate() in PgnExporter and disambiguatePiece() in GameEngine, both querying allLegalMoves to find competing pieces. 2. Check/checkmate suffix: "+" and "#" were never appended. PgnExporter now threads ctxAfter through moveToAlgebraic and calls DefaultRules.isCheck/isCheckmate. GameEngine passes PostMoveStatus to translateMoveToNotation for the same result. Also removes dead notation code in executeMoveBody (result was never used — not passed to MoveExecutedEvent). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Janis added 1 commit 2026-06-01 22:31:37 +02:00
fix(pgn): add SAN disambiguation and check/checkmate suffixes [NCS-42]
Build & Test (NowChessSystems) TeamCity build finished
3eb2736cf0
Two bugs in move notation causing PGN import failures in LiChess:

1. Disambiguation: when two pieces of same type can reach same square,
   SAN requires file/rank/full-square prefix (e.g. "Ndf3" not "Nf3").
   Added disambiguate() in PgnExporter and disambiguatePiece() in
   GameEngine, both querying allLegalMoves to find competing pieces.

2. Check/checkmate suffix: "+" and "#" were never appended.
   PgnExporter now threads ctxAfter through moveToAlgebraic and
   calls DefaultRules.isCheck/isCheckmate. GameEngine passes
   PostMoveStatus to translateMoveToNotation for the same result.

Also removes dead notation code in executeMoveBody (result was never
used — not passed to MoveExecutedEvent).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Janis merged commit 2579539084 into main 2026-06-02 11:24:28 +02:00
Janis deleted branch worktree-fix-NCS-42 2026-06-02 11:24:28 +02:00
Sign in to join this conversation.
No Reviewers
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: NowChess/NowChessSystems#56