Play · The classic

Sokoban

The 1982 classic, rebuilt as the repo's reference example — the cleanest possible showing of pure rules, a scene-tree view, and a solver that proves every level.

import { runBrowser } from 'hayao'

This isn't a video — it's the engine running the real example on this page. Arrows push, U undoes.

The reference example

This is the game every new Hayao project is copied from — pure logic in one module, the scene tree as its view, tests and a golden replay beside it.

Pure rules, machine proof

The push/undo rules are a pure Puzzle module, so the solver walks every level to the end before it ships. No level is winnable on faith.

Undo is a snapshot

State is serialized, so undo is just a snapshot stack and the whole session replays bit-for-bit — the determinism harness verifies it.

Copy this to start

Every new game begins as this one

logic.ts holds the pure rules, game.ts the view, verify.ts the proof, golden.json the replay hash. Copy the folder, swap the rules, keep the proofs — that's the whole workflow.