GenerateRandomSearch

Consecutive Run Puzzle Generator

Black squares cut every row and every column into runs. Each run has to hold consecutive numbers, though in any order at all — a run of four might be 6 3 5 4, because those are 3 to 6 shuffled. On top of that, no number may appear twice in a row or a column, exactly as in a Latin square. The two rules pull against each other and that is the whole pleasure of it: the line rule tells you what a square cannot be, and the run rule tells you what a whole stretch must add up to being.

What this generator does

Scatters black squares while keeping the white ones in one piece, fills the grid so every run and every line obeys its rule, then takes numbers away while a single answer survives.

How to use this tool

  1. Choose a grid size and how many black squares to break it up with.
  2. Print or copy the grid; the numbers already printed are what you are given.
  3. Fill each run with consecutive numbers, in whatever order fits.
  4. Keep every row and column free of repeats.
  5. Look for a run with two numbers far apart — a run of four holding 3 and 6 is already settled, because 3 to 6 is the only run of four that holds both.
  6. Show the answer to check the finished grid.

Understanding the controls

Grid
Five to seven squares a side, with seven reachable only when there are more black squares.
Black squares
How much of the grid is walled off. More black squares make a grid quicker to build and a little easier to solve, because a shorter run has fewer ways to be filled.
Seed (optional)
Type anything to rebuild the same grid later, which is how you reprint a page you have lost. A seed makes a puzzle repeatable and has no cryptographic strength whatever.

Common use cases

  • A number puzzle for anyone who has done a great many Sudoku
  • A printable page for a puzzle club, a newsletter or a long journey
  • A worked example of two constraints interacting, for a classroom
  • A short five-square grid as a warm-up, or a seven for a longer sit
  • Reprinting the identical grid later from its seed

How this generator works

The run rule is what makes the search cheap, once it is read backwards. A run of four already holding 3 and 6 is settled: 3 to 6 is the only stretch of four containing both, so the other two squares must be 4 and 5. More generally the numbers placed in a run so far must sit inside a window no wider than the run is long, and that can be tested the moment a number lands rather than when the run fills. Two other things were measured rather than assumed. Black squares make a grid *cheaper*, not dearer, because each one shortens two runs at once and takes a square out of the search — which is why the setting with fewer of them caps at a smaller grid. And the expensive step is not proving a puzzle unique but finding the first filling at all, since a grid with few walls is close to a Latin square. That step is given a budget, and a layout that overruns it is thrown away for a fresh one rather than waited on.

Randomness and fairness

The black squares, the filling and the order numbers are removed in all come from your browser's cryptographic random source. Give a seed and the same grid returns; the seed is there for reproducibility, not cryptographic strength.

For how randomness is produced across the whole site, see how Generate Random works.

Limitations and good to know

  • The grid stops at seven squares a side, and at six when there are fewer black squares — both measured limits on how long a grid takes to build.
  • About two fifths of the white squares keep their number; stripping a grid barer costs far more time than the extra difficulty is worth.
  • Black squares here carry no numbers of their own, which some versions of this puzzle use as extra clues.
  • How hard a grid is to solve is not graded, and a grid with more numbers printed is not always the easier one.

Privacy and your data

The grid is walled, filled, thinned and checked entirely in your browser. Nothing you type as a seed, and no puzzle made from it, leaves the device.