View: Multi-Page Single Page

Simple Klotski

Sliding-block puzzles — generated, solved exactly, and stamped with a proven par.

A puzzle toolkit for Unity with five modes from one workflow: Gridlock (axis-locked blocks — free the hero through the exit), Klotski (the classic dense board — walk the big block to its target), Clear (every block wears an arrow — tap to send it off, no dead ends ever), and Clear 3D (the same law in a block structure you orbit around), and Clear Snakes (ropes that slither out head first along their own body). Every board is solved by exhaustive search, rated 1–5★, stamped with its proven shortest solve, and stored as a ScriptableObject. You bring the scene, input and art — or ship the included 3D demo.

v1.0 · by Living Failure

What it is

Simple Klotski generates sliding-block puzzles — the genre of the wooden Huarong Dao puzzle and of every "shunt the cars out of the lot" game. A board is a small grid holding rectangular blocks; a move slides one block, in one direction, as far as you like. The toolkit's job is to make boards that are worth playing and to tell you exactly how hard each one is.

It doesn't just make boards — it solves them. Every generated puzzle carries its proven shortest solution (the par), how many shortest solutions exist, the moves themselves, a 1–5★ rating and a generation report. All deterministic from a seed string.

The five modes

Gridlock

Blocks are axis-locked — wide ones slide sideways, tall ones up and down. Clear a lane and drive the hero block out through the exit. Sparse, deductive, and the mode that reads instantly in a screenshot.

Klotski

The classic: a dense board where every block slides freely and there is barely room to breathe. Walk the big hero block onto its target. Long, shuffling solutions — the reference layout runs 90 moves.

Clear

Every block wears an arrow. Tap one and it flies off the board that way — if nothing is in its path. Order is the puzzle, and the mode is monotone: a solvable board can never be played into a dead end.

Clear 3D

The same law in three dimensions: a lattice of blocks with arrows in six directions, which the player orbits, pans and zooms around, peeling it apart layer by layer.

Clear Snakes

Pieces bent into ropes — Ls, Us and long snakes, each carrying one arrowhead. Tap one and it slithers out head first, its body following the same track, so only the lane ahead of the head has to be clear. Boards reach 16 a side.

Checkpoints (Gridlock and Klotski) add pressure plates: the hero reaching its goal is not enough — every plate must be held down by some block at that moment. The solver treats it as one conjoined win condition, so a non-hero block settling the last plate can be the winning move.

Features

Proven par

Breadth-first search over a canonical state space returns the true minimum move count — not an estimate, and not the generator's own construction path.

Depth engineering

Klotski boards are built backwards from the solved position, so you can ask for a 60-move puzzle and get one — then it is re-verified forwards by the solver.

No dead ends, by construction

Clear boards are built from a witness removal order, so solvability is structural — and removal is monotone, so the player can never strand themselves.

Checkpoints

Pressure plates that must be held when the hero wins — scattered by the distribution-scored placer and coverage-verified.

Obstacles

Static blocked cells, scattered by a scored placer that avoids clumping and keeps the hero's lane honest.

Difficulty stars

A 1–5★ rating banded per mode — on par for the sliding modes, on chain depth for Clear.

Deterministic

Any board reproduces exactly from its seed string; the seed travels with the puzzle asset.

ScriptableObjects

Save single puzzles or ordered packs; both feed the demo or your own scenes through a small provider interface.

Zero core deps

Pure-C# data model, solvers and generators — no Unity types in the brain. Built-in, URP and HDRP.

Editor tooling

One Generate window for all five modes: presets, Auto-tune, a target-difficulty slider, batch generation on a background thread with live progress and Cancel.

Analysis pane

Board preview, a solution scrubber that steps the board move by move, layer slices and an orbitable 3D preview for lattices, and one-click copy of the solution.

A real demo

Canvas menu and HUD, drag-to-slide and tap-to-clear input, undo, one-move hints, step-by-step auto-solve, par scoring and procedural sound.

How it works

1

Configure

Pick a mode, board size, piece count, obstacles and checkpoints, and the move window you want — in the Generate window or via GenerationSettings.

2

Generate

Each mode builds candidates its own way — scattered lanes for Gridlock, reverse-BFS depth engineering for Klotski, a witness removal order for Clear — rejecting anything that misses your constraints.

3

Solve & rate

The solver proves the shortest solution, counts how many shortest solutions exist, and rates the board. Clear boards get their chain depth and the number of valid removal orders instead.

4

Store & play

Save as a puzzle or pack ScriptableObject, drive the demo's KlotskiGame, or read the board straight off KlotskiPuzzle in your own scripts.

Why "verified" matters

Plenty of generators produce boards that happen to be solvable. This one proves the things you actually design against:

  • The par is real. Breadth-first search returns the shortest solve that exists, so a "20-move puzzle" takes 20 moves — not 20 the generator's way and 6 the player's way.
  • The difficulty window is honest. Boards outside the window you asked for are rejected, and when the generator has to fall back it says so in the report rather than quietly shipping an easy board.
  • Clear boards cannot dead-end. Removing a block only ever unblocks others, so no sequence of legal taps can strand the player. That is a property of the mode, proven once, not a per-board hope.
  • Checkpoint boards are solved as one problem. The win test is hero and coverage together, so the par accounts for the plates.

One honest limit: "exactly one shortest solution" boards are genuinely scarce in this genre. RequireUnique hunts for them, but expect fallbacks on small boards — the report always tells you which you got.

Getting started

Open Window ▸ Living Failure ▸ Simple Klotski ▸ Puzzle Generator, pick a preset, press Generate, and look at the analysis pane. Then open the demo scene and play what you made. The Quick Start walks the whole loop in about five minutes.