Files
systemic-game-design-course/course/08-push-chains/reference/ts
Lucas WintherandClaude Opus 5.5 06a1b34c5d feat: Module 11 becomes 13; diff-tracks fuzzer; align the two reference tracks
- Rename course/11-break-your-engine to 13-break-your-engine and update every
  link and mention; start-module explains that Module 13 has no tests to start.
- tools/diff-tracks.mjs (npm run diff:tracks): stages both references of a
  module, generates a seeded random SpellGrid level and script per seed, pipes
  it to the Rust and TypeScript CLIs and diffs their output; crashes on one or
  both sides fail. stagePlay takes a module number.
- register_assembled: the TypeScript track compared only the text of an
  existing Assembled card, so a base re-registered with a new cost (or a
  different split) silently rewrote the earlier card. It now compares every
  field the engine reads, as Rust does (Modules 5-10).
  New test_05_assemble_never_rewrites_an_earlier_card.
- SpellGrid CLIs: coordinates and chooser numbers are 1-9 plain digits in both
  tracks (Rust accepted signs, TypeScript accepted "+2", "0x2", "1e0"); Rust
  quotes card names verbatim instead of with Debug escapes; Rust joins the
  minion list with "; " instead of rewriting ", ". Two new CLI tests per track.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-11 10:08:56 +01:00
..
2026-10-29 04:05:42 +01:00
2026-10-29 04:05:42 +01:00
2026-10-29 04:05:42 +01:00
2026-10-29 04:05:42 +01:00
2026-10-29 04:05:42 +01:00
2026-10-29 04:05:42 +01:00

Module 8 reference engine (TypeScript)

The course's own engine as of the end of Module 8. Part I's card engine is unchanged, and all of its tests still pass. The Part II engine in src/engine/puzzle/ now moves objects: each YOU object's move is planned in full, push chain and all, and only then committed. Module 7's reference was the starting point, so a diff between the two shows what this module adds.

  • cards/ (at the package root; not in this directory): Part I's card data, a copy of course/cards/ staged by tools/verify-references.mjs. Part II doesn't read it.
  • src/engine/puzzle/: the Part II engine. It names no noun: the engine's own words are the operators IS, AND, NOT, the meta-noun TEXT, the property PUSH of the base rule TEXT IS PUSH, and from Module 8 the property YOU, which picks the objects that move.
    • grid.ts: the level format, object kinds and the board. Module 8 adds Board.find, Board.remove, Board.shift, Board.at and Kind.format (the kind as placed, for kindsAt).
    • movement.ts (new): validate, then commit. Planner (tryMove, stayingAt, destroy, has), Step, Plan, Response and Dir. The planner reads the board and plans one step at a time; for each step it runs content's movement responses in order, and rolls back everything a step added if a response blocks it. The edge of the level blocks every step, and an object that has already stepped in the same move can't step again.
    • level.ts: a level in play. Module 8 adds Level.moveYou: the YOU objects move one at a time, furthest ahead first, each planned and then committed, and an object steps at most once per move (a YOU object that an earlier move carried along doesn't start its own); the rules are reparsed once at the end. hasProperty is false for a destroyed object.
    • word.ts, parse.ts, resolve.ts: unchanged.
    • index.ts: the module's exports.
  • The rest of src/engine/: Part I, unchanged.
  • src/content/movement.ts (new) and src/content/index.ts: the movement responses, in the order the engine runs them: OPEN/SHUT, PUSH, STOP. What a property does when something moves is content, not engine.
  • src/content/words.json: Module 8 adds OPEN and SHUT.
  • src/harness.ts: the adapter the course tests call. Module 8 adds move, posOf and kindsAt on Baba.

Run it with the module's tests: node tools/verify-references.mjs 08 from the course repository.