Sharpee 2.1

Sharpee 2.1
Fully implemented phrase algebra

Phrase Algebra Fully Implemented

  • Sharpee 2.x replaces the entire text-rendering system. Text is no longer a
    string with embedded formatters; it's a tree of typed Phrase values that
    defer realization, rendered by one per-locale Assembler at the end of the
    turn.
  • The old formatter chain collapsed to a bare string after the first formatter, so nothing downstream could agree an article, pluralize a verb, or resolve a pronoun. The Assembler is now the single authority for articles, agreement, punctuation, whitespace, reference, and case.
  • Authors write {the box}{verb:is target}{contents:box} and get grammatical English for free: "an open wooden box," "the pygmy goats are dead," "a goat, a rabbit, and a parrot." That's the bar Inform 7 set, and 2.x clears it.
  • Template syntax errors now throw loudly at parse time instead of silently rotting in output.
  • The design is 15 typed phrase members; adding a text feature is one new union member, one Assembler case, one parser branch. Never a rewrite.
  • Fifteen ADRs (192–206) specify the system, including: state-derived adjectives ("the open box" from live trait state), live container contents, a contribution channel where traits/NPCs/daemons append clauses into one grammatically-joined sentence, varying and cycling text that survives save/restore, pronouns that agree with the last-mentioned entity, numerals as digits/words/ordinals, and verbatim pass-through so you never see "a north."
  • NPC speech is composition, not a subsystem: quoted dialogue gets capitalization, quote glyphs, and punctuation-inside-quotes right, and attribution agrees in number ("the triplet acrobats say").

Engine correctness (2.0–2.1)

  • Capability-behavior and action-interceptor registries moved off process-wide singletons onto the WorldModel itself (ADR-207/208). Symptom fixed: the first story loaded in a process used to win the bindings for every later game — the tutorial zoo scored 70/75 because petting silently stopped awarding. Now it's 75/75, per world, idempotent.
  • The fix was verified three ways: 201/201 transcript assertions against npm pack tarballs, then 197/197 against the real npm registry at 2.1.0.
  • 2.1.1 shipped the fixes surfaced by book validation: transcript-tester state-assertion resolution (the player reserved word, alias lookup), engine command chaining, scenery listing/article fixes, NPC direction, and devkit build fixes.

The Sharpee Author & Developer Manual v2

  • A new edition for the 2.x line: 31 chapters across 8 parts plus 5
    reference appendices, building one game (the Family Zoo) from a single
    room to a themed, tested, saved-and-restored browser release. (Note: the
    change-list doc says "36 chapters" in one place — the real count is 31;
    don't quote 36.)
  • The old "Formatter Chain" chapter is now "The Phrase Algebra" — the system
    it used to teach literally throws an error in 2.x.
  • The validation: before release, an AI agent in a clean Docker container played first-time reader — installed from npm, followed the book literally front to back, typed in every listing, ran every test. Seven rounds of fix-rebuild-rerun (Rounds A–G across nine container runs) until runs came back clean: all 31 chapters PASS, zero blocked, zero deviations, 169/169 transcript assertions, browser behavior verified with Playwright. The transcript testing was added in the new book.
  • Getting to zero took killing issue classes, not instances: the book now has four named front-matter conventions (the import, placement, replacement, and illustrative rules) that chapters cite by name, so a literal reader can never be lost about where code goes or whether a listing is meant to be typed.
  • The book teaches transcript testing by doing it: readers now build a real two-file walkthrough chain with save/restore checkpoints, event assertions, and world-state assertions — every printed listing verified green against the published packages.
  • The v1.5 edition remains available for the previous line.

The tutorial and the proving grounds

The Family Zoo tutorial split into versioned lines (v1.5.0 frozen,v2.0.0 current); v2 uses chapter-named cumulative snapshots (ch02-first-room.ts … ch28-multi-file/) that each compile against the published packages.

  • Dungeon (the Mainframe Zork port) migrated onto the phrase system and drove the story validation: article absorption, verbatim scalars, a melee blank-output fix, and the message-param contract sweep.

Road Map

There is still some changes to Dungeon based on an accepted but unimplemented ADR regarding embedded scenery in room descriptions. The author can do it themselves and not use the slots, but the new ADR will allow the author to offer a list of phrases to describe scenery. These get emitted round-robin.

Subscribe to My So Called Interactive Fiction Life

Don’t miss out on the latest issues. Sign up now to get access to the library of members-only issues.
jamie@example.com
Subscribe