View: Multi-Page Single Page

The Generate window

Open it from Window ▸ Living Failure ▸ Simple Hamiltonian ▸ Puzzle Generator (also under right-click Create ▸ Simple Hamiltonian). Settings on the left, a paged preview of results on the right.

  • Auto — one click sets Coverage (and Checkpoints / Min turns) so the current grid and shape land in the verifiable zone. Coverage is what makes or breaks uniqueness; Auto picks a value that actually works. Start here.
  • Generate / Batch count — make one or many; results append to the set. Generation runs off the UI thread, so the window stays responsive — you get an inline progress bar and a Cancel button, never a freeze.
  • Clear on generate — replace the set each click instead of appending.
  • Presets / Reset — recommended combos, or back to defaults.
  • Only unique — browse only the verified single-solution boards in the set.
  • Target difficulty — roll unique boards until they hit a 1–5 star rating (0 = any). Parallelize roll (in Advanced) runs several tries at once across CPU cores — faster on multi-core machines.
  • Verify ▾ / Re-roll ▾ / Save ▾ — dropdown actions. Save ▾ writes the current puzzle, the whole set, or pack (unique only) to disk.
  • Save name — name the saved asset file (blank = an auto name; duplicates auto-number).

Verify & Re-roll saved assets

Select a saved HamiltonianPuzzle or HamiltonianPuzzlePack in the Project window. The inspector shows a grid preview, a solution-count badge (One / Multiple / Unknown) with a difficulty rating (★), and action buttons:

  • Verify (single) · Verify Current / Verify All (pack) — re-run the solver and update the stored verdict. A dialog reports the result; Verify All lists any puzzles whose stored verdict changed (a discrepancy report), so re-imported or hand-edited boards are easy to audit.
  • Re-roll (single) · Re-roll Current / Re-roll Unverified (pack) — regenerate a slot from its own settings (size, shape, mode, checkpoints, coverage) until it comes back verified, then replace it. It prefers a unique board, falls back to any verified result, and never makes the entry worse. Re-roll Unverified fixes every "Not verified" entry in a pack in one click.
  • Undo / Redo — every verify and re-roll is undoable (buttons, or Ctrl+Z / Ctrl+Y).
TipRe-roll changes the board (it generates a new one). To keep a layout and only re-check it, use Verify instead.

Every setting

FieldRangeMeaning
Width / Height3–20Grid size (capped at 20 — the path search is recursive).
ShapeSquare / Hex4-neighbor or 6-neighbor (pointy-top, odd-r).
ModeFree / FixedEndpoint constraint (see below).
Coverage0.25–1.0Fraction of cells walkable; the rest become obstacles. The uniqueness dial — lower coverage = fewer possible paths = easier to verify unique (see below). Hit Auto to set it for your grid.
CheckpointCount0…Ordered numbered checkpoints to hit in sequence (Fixed only).
MinTurns0…Reject solutions with fewer direction changes — twistier puzzles.
RequireUniqueboolHunt for and verify a single-solution board (Fixed).
TargetDifficulty0–5Roll unique boards until one is at least this many stars; 0 = ignore difficulty (Fixed + Require unique).
SeedstringEmpty = random; any string reproduces the board exactly.
MaxAttempts1–5000Path-generation attempts before falling back to the best partial.
UniquenessNodeBudget1k–5MSolver node cap per uniqueness check.
UniquenessSeconds0.2–20Wall-clock budget for the uniqueness step.
UniqueSearchAttempts0–5000Extra candidate boards tried when hunting for a unique one.

GenerationSettings.Clamp() coerces every field into its valid range, so you can pass anything safely.

Coverage & uniqueness

Coverage is the single most important setting for unique boards. A nearly-full grid has a huge number of valid Hamiltonian paths, so the solver can't prove any one of them the only solution — you get "Not verified". Obstacles (lower coverage) constrain the path until exactly one solution remains: the holes are what make a board uniquely solvable, and a fully-covered board is almost never unique. It's a genuine tradeoff, not a defect — a full-grid snake looks tidy but is a trivial, multi-solution puzzle.

Measured rule of thumb: a board verifies reliably while width × height × coverage² stays under about 55 (Square) or 32 (Hex). Hex has six neighbors per cell — far more paths — so it needs much lower coverage than a square grid of the same size. Checkpoints add ordered structure but barely move uniqueness; coverage is the real lever.

Just hit AutoRather than tune coverage by hand, click Auto in the generate window — it solves that rule for your grid and shape (e.g. 10×10 hex → ~0.52, 10×10 square → ~0.68), then sets a matching checkpoint count and gentle twistiness. The window also warns inline the moment your settings drift past the cliff.

Difficulty rating

Every verified-unique board is rated 1–5 stars from the solver's search effort — how much backtracking it takes to prove the single solution. Bigger, more open boards rate higher; heavy constraints (many checkpoints, sparse coverage) rate lower. Only Fixed + verified-unique boards are rated — Free or unverified boards show no stars.

Set Target difficulty to roll boards until one reaches that rating (it returns the first board to hit it, or the hardest found within budget). The rating is stored on PuzzleData.Difficulty and shown in the badge and facts of every preview and inspector. In code, Difficulty.Stars(verdict) computes it from a SolutionVerdict.

NoteThe rating tracks the shipped solver's effort, not a human's — it's a consistent, reproducible proxy for how hard a board is to crack.

Free vs Fixed

Free — the path may start and end anywhere; usually many solutions (casual). Fixed — a set start and end cell, plus optional ordered checkpoints the solution must visit in numbered order. Uniqueness is achievable in Fixed mode, so it's the one to use for "verified unique" boards.

Square vs Hex

Square is a 4-neighbor grid (up/down/left/right). Hex is a 6-neighbor pointy-top grid using odd-r offset coordinates. The generator, solver, and rules are all topology-aware, so the same settings and API produce correct boards for either — and the uniqueness solver is proven sound on both.

NoteSquare output is identical whether or not hex exists — the square neighbor order matches the original implementation exactly.

Seeds & determinism

Generation is fully deterministic per seed on the same machine (a custom SplitMix64 RNG). Leave Seed empty for a fresh random board, or set a string to reproduce one exactly. Share the seed string instead of the puzzle data — it's tiny and regenerates the same board. Batches derive per-puzzle seeds from the root, so a batch reproduces too.

Async & batches

For runtime generation behind a loading screen, use the async helpers so the main thread never blocks:

// background thread, reports 1..count for a progress bar
var levels = await HamiltonianGenerator.GenerateBatchAsync(settings, 20,
    new System.Progress<int>(done => bar.value = done / 20f));

The generator is pure C# with no Unity API calls, so it is safe to run on a thread pool; the await resumes on Unity's main thread automatically.