Engine PR 8.3: en passant — capture generation + applyMove removal #70
Labels
No labels
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
spec
wayfinder:grilling
wayfinder:map
wayfinder:prototype
wayfinder:research
wayfinder:task
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
amaurycoudr/chess-project#70
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Parent
#67
What to build
Additive on slice 8.1: the en passant capture. Slice 8.1 already sets the en passant target square on a double push; this slice generates the capture that consumes it and applies the board change.
Implements step 8 (partial) of
docs/adr/0004-engine-slice-plan-and-king-first-piece-ordering.md.pseudoLegalPawnMovesinmovegen.ts: when a side-to-move pawn attacksposition.ep, generate an en passant capture move to that square (even though it is empty).applyMoveinrules.ts: detect the en passant capture structurally (a pawn mover moving diagonally onto the emptyposition.epsquare) and remove the enemy pawn from the square behind the destination — not from the destination itself.rules-pawns.test.tswith en passant coverage: capture availability only on the ply after the enabling double push, correct captured-pawn removal, en passant unavailable when no enemy pawn is positioned to take, and the en-passant-discovered-check case (an en passant capture that exposes the mover's own king is rejected by the existing legality filter).The en-passant-discovered-check case falls out for free once
applyMoveremoves the correct pawn — removing the captured pawn can open a rank for an enemy rook/queen onto the mover's king. It should be covered by an explicit test.Acceptance criteria
pseudoLegalPawnMovesgenerates an en passant capture when a side-to-move pawn attacksposition.epposition.epis undefined or no pawn attacks itGame.apply()of an en passant capture moves the capturing pawn toepand removes the enemy pawn from the square behind the destinationlegalMovesrules-knights.test.ts/rules-pawns.test.tsstyle, written as vertical TDD slicespnpm lint,pnpm typecheck,pnpm test,pnpm buildall green from the repo rootBlocked by
Implemented by Sandcastle on branch
sandcastle/sequential-reviewer/1778951121227— awaiting review. Adds en passant capture generation in pseudoLegalPawnMoves and structural en passant detection in applyMove with correct captured-pawn removal.Promoted to branch
feat/engine-pr-8-1-pawns-pushes-captures-attack-mask-legality-wiring-68(PR #72), not yet merged to main. A dependent slice shouldgit fetch origin feat/engine-pr-8-1-pawns-pushes-captures-attack-mask-legality-wiring-68and branch off it.mentioned in issue #71
mentioned in commit
89bdac7e03