Skip to content

Fix en passant not set when parsing PGN via Game.make(move:from:) - #78

Open
mirkoleardini wants to merge 2 commits into
chesskit-app:masterfrom
mirkoleardini:fix/en-passant-game-make
Open

Fix en passant not set when parsing PGN via Game.make(move:from:)#78
mirkoleardini wants to merge 2 commits into
chesskit-app:masterfrom
mirkoleardini:fix/en-passant-game-make

Conversation

@mirkoleardini

Copy link
Copy Markdown

Game.make(move:from:) was not updating enPassant on the new position when a pawn advanced two squares. This caused the subsequent position to have no knowledge of the en passant possibility, making SANParser fail to find a legal pawn capture (e.g. cxd6) and throwing PGNParser.Error.invalidMove.

Board.move() handled this correctly — Game.make() now mirrors that behavior by setting enPassant and enPassantIsPossible when a pawn moves two squares, and clearing them otherwise.

Game.make(move:from:) was not updating enPassant on the new position
when a pawn advanced two squares. This caused the subsequent position
to have no knowledge of the en passant possibility, making SANParser
fail to find a legal pawn capture (e.g. cxd6) and throwing
PGNParser.Error.invalidMove.

Board.move() handled this correctly — Game.make() now mirrors
that behavior by setting enPassant and enPassantIsPossible when
a pawn moves two squares, and clearing them otherwise.
@pdil pdil added the bug A bug or issue that should be resolved label Aug 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug A bug or issue that should be resolved

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants