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 / proposal.md
proposal.md 2.0K source

Why

The real-engine solver retains a full cloned board and growing path string for every breadth-first node. Current authored worlds need millions of expansions, and the handwritten state key would omit future gate, switch, or crumble state. W6 also exposed how important exact snapshot replay is for noun transformations. The solver needs a compact, authoritative state contract before it becomes a bundled-world CI gate or a basis for stateful mod mechanics.

What Changes

  • Add a canonical solver-state codec that round-trips settled engine state and distinguishes every variable that can affect future turns, including object existence, position and noun, automata phase, and registered mechanics state.
  • Replace full-snapshot frontier nodes and repeated path strings with compact state blobs, a queue, and predecessor links while preserving shortest paths. Correct --forbid to exclude rules active at the start or transiently during a turn, and distinguish BYPASS from HANDS-OFF evidence.
  • Provide a no-presentation engine transition path for solver exploration, with differential checks against ordinary createGame().step() and wait() before the solver uses it.
  • Fail closed when an added stateful mechanic lacks codec coverage, so future gates, switches, or one-step tiles cannot silently merge distinct states.
  • Measure representative current worlds and report expansions, time, and memory before and after the change. The existing author-facing solver command stays compatible.

Capabilities

New Capabilities

  • solver-state-search: canonical compact solver states, equivalent fast transitions, and bounded shortest-path search.

Modified Capabilities

None.

Impact

tools/solve.mjs, new solver codec/search modules and tests, and an engine search transition boundary. Engine snapshots remain the authoritative state shape. World pack files and designer-owned presentation files are outside this change; future mechanic specs must register their state with the codec before solver acceptance.