Engine PR 8.2: pawn promotion — last-rank move expansion + applyMove piece placement #69
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#69
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: handle pawns reaching the last rank. A pawn move (push or capture) landing on the final rank expands into four
Moves — one per promotion piecen/b/r/q— andapplyMovelands the mover as the chosen piece instead of a pawn.Slice 8.1 deliberately omits last-rank pawn moves; this slice adds them back, the only mechanism by which a pawn legally reaches the last rank.
Implements step 8 (partial) of
docs/adr/0004-engine-slice-plan-and-king-first-piece-ordering.md.pseudoLegalPawnMovesinmovegen.ts: a generated pawn move whose destination is on the last rank fans into fourMoves withpromotionset ton,b,r,q. Applies equally to straight pushes and diagonal captures.applyMoveinrules.ts: whenmove.promotionis set, the mover is removed from the pawn set and added to the promotion piece's set on the destination, rather than remaining a pawn.rules-pawns.test.tswith promotion coverage (four-way expansion, capture-promotion,applyMovepiece placement, promotion-with-check).Move.promotion, themoveOfhelper, andGame.apply's promotion-aware legality comparison already exist — no type changes.Acceptance criteria
promotionn/b/r/qGame.apply()of a promotion move removes the pawn and places the chosen piece on the destination squareGame.status()promotionfield (no regression from 8.1)rules-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/1778950044172— awaiting review. Adds last-rank move expansion (4 promotion variants per push/capture) and applyMove promotion handling.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
ed7e97de1c