clone

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

main
miau-is-true / openspec / changes / archive / 2026-09-24-scale-solver-state-search / state-inventory.md
state-inventory.md 2.0K source

Settled state inventory for W3

The authoritative shape is game.getState() from src/engine.js after a turn or restore. The compact solver stores only values that can change the next transition. game.restore() reconstructs rule and automata projections from the decoded values.

Field Role Codec treatment
width, height, title, hint Static level definition Check board identity; restore from the authored level.
objects[].id, kind, word text Static authored identity Fixed slot and metadata; presence bit distinguishes destruction.
objects[].x, y Dynamic positions Encode a cell for each surviving object.
Object noun Dynamic transformation result Encode a noun index for each surviving non-word object.
automata[].id, subject, property, pattern Static definitions Stable system-ID slots and authored metadata.
automata[].phase Dynamic beat position Encode for every system, including inactive systems.
automata[].active, carriers, instanceIds, next Derived from rules, objects, and phase Recompute after restore.
rules, sentences Derived from surviving word positions and texts Recompute after restore.
moves Display/history count; no current mechanic reads it Exclude from search identity; BFS depth is the shortest count.
won Terminal result Check before enqueue; nonterminal encoded states use false.
mechanics Future persistent gate/switch/crumble state Require explicit codec registration for each dynamic field.

The current engine has no mechanics envelope. Future changes must add state there and prove that two identical boards with different mechanic values produce different solver identities. A new unrecognized state field must fail encoding until this inventory and codec are updated.

The 8ecc483 restore correction is required by this model: restoring a settled noun must not run another transformation link. The codec's decode/restore tests guard that invariant in addition to the engine fixture.