Context
The W6 audit compares current behavior with Baba-style author expectations. The engine already has stable movement and contact phases, but several outcomes depend on incidental occupant or authored object order. The worlds team has settled stacked parsing: choose one token per cell/path, enumerate every valid alternative, and allow a sentence to start at a stacked cell.
Goals / Non-Goals
Goals:
- Make STOP/PUSH, DEFEAT/WIN, and singleton hazard outcomes explicit.
- Make self-transform suppression and competing noun transformations deterministic.
- Preserve one-link transformation semantics within a turn.
- Add regression fixtures that expose event order and resulting nouns.
- Parse stacked cells with one selected token per cell/path and enumerate every valid alternative.
Non-Goals:
- Permissive combinations of all stacked tokens.
- Reworking Crossword levels before applying the settled parser contract.
- Adding new vocabulary, goals, automata, or contact timing modes.
Decisions
PUSH wins over STOP when carried by one object
When the same destination object carries both STOP and PUSH, PUSH allows the object to be pushed rather than treating its STOP as a block. This matches the worlds audit's Baba-compatible semantics; treating STOP first prevents intended ROCK IS STOP AND PUSH behavior.
Resolve defeat before victory, including singleton entities
Contact resolution evaluates DEFEAT before WIN. A singleton entity carrying both YOU and DEFEAT is removed and cannot win from its own WIN property. The same ordering applies when distinct entities overlap.
Self-transform rules suppress other transforms
X IS X contributes no noun change, but its presence suppresses every other noun transformation for X in that turn. This makes ROCK IS ROCK plus ROCK IS FLAG stable regardless of parse order and avoids an incidental transform conflict.
Choose transformations by spatial rule-reading order and apply one link
For one noun with multiple valid noun targets, select the first rule by the first word's spatial reading order: first-word row top-to-bottom, then left-to-right, then sentence token order. Apply at most one noun transformation per object per turn; do not recursively apply the result to another noun rule until a later turn. This keeps A IS B and B IS C as a one-link chain.
Enumerate stacked-cell alternatives by path
For every stacked cell in a candidate sentence path, select one word and enumerate each valid alternative. Sentence scanning may begin at a stacked cell. This yields ROCK [AND+IS] FLAG as ROCK IS FLAG, ROCK IS [WIN+PUSH] as two rules, [ROCK+FLAG] IS WIN as two rules, and ROCK AND [FLAG+IS] IS WIN as ROCK IS WIN plus FLAG IS WIN. The permissive combination of all stacked tokens is excluded.
Risks / Trade-offs
- [Risk] Existing levels rely on authored object order for transform conflicts. → Add fixtures and review affected worlds before enabling the new order broadly.
- [Risk] Singleton YOU+DEFEAT changes a loss outcome. → Add explicit event/state assertions and rerun bundled solver checks.
- [Risk] Spatial ordering differs from author expectations. → Expose source rule IDs and axis in settled state and document the ordering.
- [Risk] Stacked alternatives multiply candidate sentences. → Enumerate valid one-token-per-cell paths deterministically and deduplicate semantic rules while retaining physical sources.
Migration Plan
- Add focused engine tests for precedence and deterministic reading.
- Implement parser/contact changes behind the existing deterministic engine path.
- Run bundled solver and browser regression checks.
- Re-run Crossword solver/content checks against the settled stacked-cell grammar.
Open Questions
- Are there additional stacked-cell fixtures beyond the worlds table that need explicit regression coverage?
- Does the worlds team require source-span ordering in the visible rule ledger as well as the engine rule table?