Files
systemic-game-design-course/course/11-conditions/reference/ts/README.md
T
Lucas WintherandClaude Opus 5.5 34c655c1a4 feat: Module 11, Conditions (NOUN ON NOUN IS ..., checked per object at use; NEAR as the Expansion Drop)
Adds course/11-conditions: lesson, scenarios, nine test_11 tests in both
tracks, the cumulative reference (Module 10's plus conditions) and the NEAR
drop. The engine learns a condition role, rules carry conditions, and
Level.hasProperty and conversion evaluate content's condition checks against
the board whenever a rule is used. Resolution pairs only rules with the same
conditions. Catalog, harness contract, research notes and the diff-tracks
generator follow.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-11 13:00:26 +01:00

2.4 KiB
Raw Blame History

Module 11 reference engine (TypeScript)

The course's own engine as of the end of Module 11: Module 10's engine (Part I's card engine and Part II's grid engine, joined by SpellGrid), with conditions in Part II. Every test from Modules 1–10 still passes. Module 10's reference was the starting point, so a diff between the two shows what this module adds. course/10-spellgrid/reference/ts/README.md describes everything else.

  • cards/ and levels/ (at the package root; not in this directory): staged by tools/verify-references.mjs as for Module 10 (course/cards/, course/10-spellgrid/cards/ and course/10-spellgrid/levels/), so SpellGrid's tests run here too.
  • Part II (src/engine/puzzle/):
    • word.ts: a fourth role, "condition".
    • parse.ts: Condition { word, nouns } and Rule.conditions. beforeIs reads what stands before an IS: the subjects alone, or, when a condition word stands before the run of nouns next to IS, the subjects before that word with the condition (nounRuns reads one noun from each tile of a stack). ruleText writes BABA ON KEY AND ROCK IS WIN. negates and the new sameConditions pair rules only with the same conditions.
    • resolve.ts: negation and the identity lock pair rules only when their conditions are the same.
    • condition.ts (new): ConditionCheck, (level, id, nouns) => boolean, and ConditionChecks, content's checks by word.
    • level.ts: the constructor takes the condition checks and throws if a condition word has none. appliesTo(rule, id) (the subject names the object and every condition holds for it now) is what hasProperty and conversion use, so every question about an object evaluates its conditions at that moment. names(word, id) is public, for content's checks.
  • Part III (src/engine/spellgrid.ts): SpellGrid's constructor takes the condition checks; ruleAuras skips a rule with a condition.
  • src/content/conditions.ts (new): on, registered under ON. words.json adds { "name": "ON", "role": "condition" }.
  • src/harness.ts: newBaba and newSpellGrid pass conditions(). No new harness function: rules() and activeRules() print conditions.
  • src/cli.ts: unchanged from Module 10. tools/play-spellgrid.mjs plays Module 10's; tools/diff-tracks.mjs uses this module's by default.

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