Engine PR 8.4: king+pawn perft validation #71

Closed
opened 2026-05-16 16:04:24 +00:00 by root · 3 comments
root commented 2026-05-16 16:04:24 +00:00 (Migrated from gitlab.core-project.space)

Imported from GitHub amaurycoudr/chess-project#71, opened by @amaurycoudr on 2026-05-16 16:04 UTC.
Closed on GitHub on 2026-05-16 21:37 UTC as completed.


Parent

#67

What to build

Prove pawn move generation and legality correct by perft. The reference data already exists: packages/engine/src/perft-fixtures.ts exports PAWN_PERFT_CASES, six positions with Stockfish 18-verified depth/node tables, each isolating a pawn mechanic (double pushes, en passant from the root FEN, en passant created mid-search, push-promotion, capture-promotion, pawns + knight together). This slice consumes that data — it does not pick new positions or re-run Stockfish.

Extend perft.test.ts with a describe block that walks PAWN_PERFT_CASES, mirroring the existing king/knight blocks: each case is parsed from its fen via the file's positionFromFen helper, then driven through the perft helper with an it.each over counts. Choose a per-case depth ceiling that keeps the suite fast (the existing king/knight perft tops out around 90k nodes — match that order of magnitude; the deeper rows in the fixture are reference values, not all meant to run).

Implements step 8 (final part) of docs/adr/0004-engine-slice-plan-and-king-first-piece-ordering.md.

PAWN_PERFT_CASES is deliberately kept out of the running test until pawns exist (see the note in perft-fixtures.ts); wiring it in is part of this slice. The node counts are valid against our engine because every position uses only kings, pawns, knights, and — after promotion — sliders, all of which the engine implements by step 8; no position carries castling rights, the one rule still missing.

Acceptance criteria

  • perft.test.ts consumes PAWN_PERFT_CASES from perft-fixtures.ts — no hand-picked positions or counts duplicated into the test
  • Each case is parsed from its fen via the existing positionFromFen helper and validated with the existing perft helper
  • Every fixture position is exercised; the depth ceiling per case is chosen so the suite stays in the ~100k-node-per-case range, consistent with the existing king+knight perft
  • The run collectively covers double pushes, en passant (root-FEN and mid-search), push-promotion, and capture-promotion — guaranteed by exercising all six cases
  • Tests follow the existing perft.test.ts structure (describe.each per group, it.each depth table)
  • pnpm lint, pnpm typecheck, pnpm test, pnpm build all green from the repo root

Blocked by

> _Imported from GitHub [amaurycoudr/chess-project#71](https://github.com/amaurycoudr/chess-project/issues/71), opened by [@amaurycoudr](https://github.com/amaurycoudr) on 2026-05-16 16:04 UTC._ > _Closed on GitHub on 2026-05-16 21:37 UTC as completed._ <!-- github-issue:71 --> --- ## Parent #67 ## What to build Prove pawn move generation and legality correct by perft. The reference data already exists: `packages/engine/src/perft-fixtures.ts` exports `PAWN_PERFT_CASES`, six positions with Stockfish 18-verified depth/node tables, each isolating a pawn mechanic (double pushes, en passant from the root FEN, en passant created mid-search, push-promotion, capture-promotion, pawns + knight together). This slice consumes that data — it does **not** pick new positions or re-run Stockfish. Extend `perft.test.ts` with a `describe` block that walks `PAWN_PERFT_CASES`, mirroring the existing king/knight blocks: each case is parsed from its `fen` via the file's `positionFromFen` helper, then driven through the `perft` helper with an `it.each` over `counts`. Choose a per-case depth ceiling that keeps the suite fast (the existing king/knight perft tops out around 90k nodes — match that order of magnitude; the deeper rows in the fixture are reference values, not all meant to run). Implements step 8 (final part) of `docs/adr/0004-engine-slice-plan-and-king-first-piece-ordering.md`. `PAWN_PERFT_CASES` is deliberately kept out of the running test until pawns exist (see the note in `perft-fixtures.ts`); wiring it in is part of this slice. The node counts are valid against our engine because every position uses only kings, pawns, knights, and — after promotion — sliders, all of which the engine implements by step 8; no position carries castling rights, the one rule still missing. ## Acceptance criteria - [ ] `perft.test.ts` consumes `PAWN_PERFT_CASES` from `perft-fixtures.ts` — no hand-picked positions or counts duplicated into the test - [ ] Each case is parsed from its `fen` via the existing `positionFromFen` helper and validated with the existing `perft` helper - [ ] Every fixture position is exercised; the depth ceiling per case is chosen so the suite stays in the ~100k-node-per-case range, consistent with the existing king+knight perft - [ ] The run collectively covers double pushes, en passant (root-FEN and mid-search), push-promotion, and capture-promotion — guaranteed by exercising all six cases - [ ] Tests follow the existing `perft.test.ts` structure (`describe.each` per group, `it.each` depth table) - [ ] `pnpm lint`, `pnpm typecheck`, `pnpm test`, `pnpm build` all green from the repo root ## Blocked by - Blocked by #69 and #70
root commented 2026-05-16 17:20:21 +00:00 (Migrated from gitlab.core-project.space)

Imported from a GitHub comment by @amaurycoudr on 2026-05-16 17:20 UTC.

Implemented by Sandcastle on branch sandcastle/sequential-reviewer/1778951767805 — awaiting review. Wires PAWN_PERFT_CASES into perft.test.ts with a 110k-node ceiling, exercising all six pawn positions.

> _Imported from a [GitHub comment](https://github.com/amaurycoudr/chess-project/issues/71#issuecomment-4467580321) by [@amaurycoudr](https://github.com/amaurycoudr) on 2026-05-16 17:20 UTC._ <!-- github-comment:4467580321 --> Implemented by Sandcastle on branch `sandcastle/sequential-reviewer/1778951767805` — awaiting review. Wires PAWN_PERFT_CASES into perft.test.ts with a 110k-node ceiling, exercising all six pawn positions.
root commented 2026-05-16 17:26:56 +00:00 (Migrated from gitlab.core-project.space)

Imported from a GitHub comment by @amaurycoudr on 2026-05-16 17:26 UTC.

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 should git fetch origin feat/engine-pr-8-1-pawns-pushes-captures-attack-mask-legality-wiring-68 and branch off it.

> _Imported from a [GitHub comment](https://github.com/amaurycoudr/chess-project/issues/71#issuecomment-4467607607) by [@amaurycoudr](https://github.com/amaurycoudr) on 2026-05-16 17:26 UTC._ <!-- github-comment:4467607607 --> 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 should `git fetch origin feat/engine-pr-8-1-pawns-pushes-captures-attack-mask-legality-wiring-68` and branch off it.
root (Migrated from gitlab.core-project.space) closed this issue 2026-05-16 21:37:09 +00:00
root commented 2026-10-13 10:20:26 +00:00 (Migrated from gitlab.core-project.space)

mentioned in commit 616b4dd697

mentioned in commit 616b4dd697f3e5839bc5c8c16d6d067c5bd53dd8
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
amaurycoudr/chess-project#71
No description provided.