View: Multi-Page Single Page

Install & requirements

Import the package. The Core (generation / solving / rules / data / ScriptableObjects) has no package dependencies and works in any render pipeline.

The demo uses the Input System and TextMeshPro packages and ships on the Built-in pipeline. On URP/HDRP, run Unity's material converter on the demo materials — the generator itself is pipeline-agnostic. Requires Unity 6000.3+.

Assembly definitionsCore, Demo, and Editor are separate asmdefs, so the generator never pulls in the demo's packages.

No-code start

1

Open the generator

Window ▸ Living Failure ▸ Simple Hamiltonian ▸ Puzzle Generator.

2

Configure & generate

Pick Shape (Square/Hex), Mode and size, then click Auto — it sets Coverage (the setting that makes a board verify unique) for your grid. Click Generate (or a batch). Preview on the right; page with < >.

3

Save

Use Save ▾ — write the current puzzle, the whole set, or pack (unique only) into your project.

Code start

using SimpleHamiltonian;

var settings = new GenerationSettings {
    Width = 6, Height = 6,
    Shape = GridShape.Hex,        // or GridShape.Square
    Mode  = PuzzleMode.Fixed,     // Fixed = start/end + ordered checkpoints
    CheckpointCount = 2,
    RequireUnique = true,
    TargetDifficulty = 3,         // 0 = any; else roll toward a 1–5 star rating
};

// One verified puzzle (uniqueness-checked, difficulty-stamped):
PuzzleData puzzle = HamiltonianGenerator.GenerateVerified(settings);
int stars = puzzle.Difficulty;   // 1..5 (0 if not verified-unique)

// A pack of N (deterministic per seed):
List<PuzzleData> pack = HamiltonianGenerator.GenerateBatch(settings, 10);

// Off the main thread, with progress (ideal behind a loading screen):
var levels = await HamiltonianGenerator.GenerateBatchAsync(settings, 10,
    new System.Progress<int>(done => Debug.Log($"{done}/10")));

Playing a puzzle

Feed your current path to the stateless rules API:

// Legal move? (walkable, no revisit, adjacent, Fixed-mode start rule)
bool ok  = HamiltonianRules.IsLegalStep(puzzle, currentPath, nextCell);

// Solved? (covers every cell; Fixed also checks start/end + checkpoint order)
bool won = HamiltonianRules.IsSolved(puzzle, currentPath);
TipTo see it wired end to end, open the demo scene (Demos) and read LevelGame + HamiltonianRules.

Next steps