clone

a browser grid puzzle game where you push words around to rewrite the rules of each level

Settle stacked-word reading contract for W6

Dami committed c655de3
commit
c655de36efeb10b0cd3d03d8b633ead3b25b1c7e
parent
cce20af6bbfcbebcb4d4ac1f7d1bcc68a96de8f1
author
Dami <dami.etoile@gmail.com>
4 files changed, +39 -23
Mopenspec/changes/fix-rule-precedence-and-reading/design.md22++++++++++----------
Mopenspec/changes/fix-rule-precedence-and-reading/proposal.md4++--
Mopenspec/changes/fix-rule-precedence-and-reading/specs/rule-precedence-and-reading/spec.md32+++++++++++++++++++++++--------
Mopenspec/changes/fix-rule-precedence-and-reading/tasks.md4++--
M openspec/changes/fix-rule-precedence-and-reading/design.md +11 -11
@@ -1,6 +1,6 @@
11 ## Context22 3-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 also needs a decision on whether stacked cells select one token per grammar path or allow permissive alternatives; that choice is not settled and must not be hidden in this change.3+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.44 55 ## Goals / Non-Goals66
@@ -10,12 +10,12 @@ The W6 audit compares current behavior with Baba-style author expectations. The
1010 - Make self-transform suppression and competing noun transformations deterministic.1111 - Preserve one-link transformation semantics within a turn.1212 - Add regression fixtures that expose event order and resulting nouns.13-- Keep the stacked-cell AND choice visible as an open question.13+- Parse stacked cells with one selected token per cell/path and enumerate every valid alternative.1414 1515 **Non-Goals:**1616 17-- Choosing or implementing the one-token-per-cell versus permissive stacked grammar.18-- Reworking Crossword levels before the worlds reply.17+- Permissive combinations of all stacked tokens.18+- Reworking Crossword levels before applying the settled parser contract.1919 - Adding new vocabulary, goals, automata, or contact timing modes.2020 2121 ## Decisions
@@ -34,27 +34,27 @@ Contact resolution evaluates DEFEAT before WIN. A singleton entity carrying both
3434 3535 ### Choose transformations by spatial rule-reading order and apply one link3636 37-For one noun with multiple valid noun targets, select the first rule in the parser's documented spatial order: rule origin in row-major board order, then horizontal before vertical at the same origin, 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.37+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.3838 39-### Leave stacked-cell AND grammar unresolved39+### Enumerate stacked-cell alternatives by path4040 41-The spec records the competing options: one selected token per cell/path with valid alternatives enumerated, or permissive stacked grammar. No parser implementation choice is made until worlds confirms the intended contract.41+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.4242 4343 ## Risks / Trade-offs4444 4545 - [Risk] Existing levels rely on authored object order for transform conflicts. → Add fixtures and review affected worlds before enabling the new order broadly.4646 - [Risk] Singleton YOU+DEFEAT changes a loss outcome. → Add explicit event/state assertions and rerun bundled solver checks.4747 - [Risk] Spatial ordering differs from author expectations. → Expose source rule IDs and axis in settled state and document the ordering.48-- [Risk] Stacked grammar remains unresolved. → Keep Crossword changes deferred and require a follow-up spec decision.48+- [Risk] Stacked alternatives multiply candidate sentences. → Enumerate valid one-token-per-cell paths deterministically and deduplicate semantic rules while retaining physical sources.4949 5050 ## Migration Plan5151 5252 1. Add focused engine tests for precedence and deterministic reading.5353 2. Implement parser/contact changes behind the existing deterministic engine path.5454 3. Run bundled solver and browser regression checks.55-4. Revisit stacked-cell grammar in a follow-up after worlds confirmation.55+4. Re-run Crossword solver/content checks against the settled stacked-cell grammar.5656 5757 ## Open Questions5858 59-- Should stacked-cell grammar select one token per cell/path and enumerate valid alternatives, or permit permissive stacked combinations?60-- Does the worlds team accept row-major, horizontal-before-vertical rule order for transformation conflicts?59+- Are there additional stacked-cell fixtures beyond the worlds table that need explicit regression coverage?60+- Does the worlds team require source-span ordering in the visible rule ledger as well as the engine rule table?
M openspec/changes/fix-rule-precedence-and-reading/proposal.md +2 -2
M openspec/changes/fix-rule-precedence-and-reading/specs/rule-precedence-and-reading/spec.md +24 -8
@@ -34,10 +34,10 @@ The engine SHALL treat `X IS X` as a no-op for the object's noun while its prese
3434 - **THEN** ROCK objects retain ROCK and do not transform to FLAG regardless of which sentence is parsed first3535 3636 ### Requirement: Competing noun transformations SHALL use spatial reading order37-When a noun has multiple valid noun transformation targets, the engine SHALL choose the first rule in deterministic spatial reading order: rule origin row-major, horizontal before vertical at the same origin, then sentence token order. The selected source rule SHALL remain observable in the settled transformation record.37+When a noun has multiple valid noun transformation targets, the engine SHALL choose 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. The selected source rule SHALL remain observable in the settled transformation record.3838 39-#### Scenario: Earlier spatial rule wins40-- **WHEN** BABA has valid transformations from two sentence origins and one origin is earlier in row-major reading order39+#### Scenario: Earlier first word wins40+- **WHEN** BABA has valid transformations from two sentence origins and one first word is earlier top-to-bottom, then left-to-right4141 - **THEN** BABA transforms to the target from the earlier rule regardless of authored object array order4242 4343 ### Requirement: Noun transformations SHALL apply one link per turn
@@ -47,9 +47,25 @@ The engine SHALL apply at most one noun-to-noun transformation link to each obje
4747 - **WHEN** the board contains `BABA IS ROCK` and `ROCK IS FLAG`4848 - **THEN** a BABA object becomes ROCK for that turn and does not become FLAG until a later turn that still satisfies the second rule4949 50-### Requirement: Rule reading SHALL keep stacked-cell grammar explicit51-The engine SHALL not silently broaden or narrow stacked-cell AND parsing as part of this change. The accepted grammar SHALL be chosen in a follow-up decision between one selected token per cell/path with valid alternatives enumerated and permissive stacked combinations.50+### Requirement: Rule reading SHALL select one stacked token per cell/path and enumerate alternatives51+For each candidate sentence path, the parser SHALL select one word from each stacked cell, enumerate every valid alternative, and allow a sentence to start at a stacked cell. It SHALL not combine all stacked tokens as one permissive grammar. The resulting semantic rules SHALL remain deterministically ordered and physically sourced.5252 53-#### Scenario: The unresolved grammar is surfaced54-- **WHEN** a level uses stacked words around `AND` or `IS`55-- **THEN** validation or authoring review identifies the grammar decision as pending rather than treating one interpretation as a settled W6 contract53+#### Scenario: A stacked operator cell yields one valid rule54+- **WHEN** the path is `ROCK [AND+IS] FLAG`55+- **THEN** the parser includes `ROCK IS FLAG` as a valid alternative56+57+#### Scenario: A stacked noun before IS yields the valid alternative58+- **WHEN** the path is `MIAU [AND+ROCK] IS YOU`59+- **THEN** the parser includes `ROCK IS YOU` only and does not treat `MIAU AND ROCK IS YOU` as one malformed subject path60+61+#### Scenario: A stacked predicate enumerates alternatives62+- **WHEN** the path is `ROCK IS [WIN+PUSH]`63+- **THEN** the parser includes both `ROCK IS WIN` and `ROCK IS PUSH`64+65+#### Scenario: A stacked subject enumerates alternatives66+- **WHEN** the path is `[ROCK+FLAG] IS WIN`67+- **THEN** the parser includes both `ROCK IS WIN` and `FLAG IS WIN`68+69+#### Scenario: A stacked AND path starts from each valid subject70+- **WHEN** the path is `ROCK AND [FLAG+IS] IS WIN`71+- **THEN** the parser includes `ROCK IS WIN` and `FLAG IS WIN` from the valid alternatives and excludes malformed combinations
M openspec/changes/fix-rule-precedence-and-reading/tasks.md +2 -2