Shingoki Puzzle Generator
One closed loop runs through this grid's cell centres, moving only up, down, left and right, and it has to visit every circled cell — though not necessarily any of the others. A black circle forces the loop to turn there; a white circle forces it to run straight through instead. Every circle also carries a number, and that number is not a count of cells or a distance to an edge — it is the combined length of the loop's own two straight stretches leaving that circle, each measured out to (and including) the next cell where the loop turns. A turn one step either side of a black circle reads as 1 + 1 = 2; a long straight run before the loop finally bends reads as a much bigger number. Working out where those turns really are, from the numbers alone, is the puzzle.
What this generator does
Draws a random closed loop first, using the same cell-by-cell search this site's own Masyu (pearl loop) generator uses to settle a single circuit with nothing left dangling. Every cell the loop passes through then earns a circle: black with a number if the loop turns there, white with a number if it runs straight through — the number itself is read directly off the finished loop, by walking outward from that cell in each of its two directions until the next turn. Circles are then removed one at a time, in a random order, keeping each removal only once an independent solver — reading nothing but the remaining circles' colours and numbers — proves the loop is still the only one they allow.
How to use this tool
- Choose a grid size, then print or copy it.
- Draw one closed loop through cell centres, visiting every circle.
- Turn at every black circle; run straight through every white one.
- Check each circle's number against the combined length of its own two straight stretches out to the next turn.
- Show the answer to check the finished loop.
Understanding the controls
- Grid
- 5, 6 or 7 squares a side. All three are measured to settle well inside a page-load budget, worst case.
- Seed (optional)
- Type anything to rebuild the same puzzle later, which is how you reprint a page you have lost. The seed makes the puzzle repeatable; it carries no cryptographic strength and is not a secret.
Common use cases
- A loop puzzle where the clue is a length, not a visibility count or a shape
- Practice working backward from a single number to where a whole straight run must end
- A change of pace from this site's other loop puzzles, which clue by turning rule alone or by what a cell can see, never by measuring the loop's own reach
- Reprinting the identical grid later from its seed
How this generator works
A circle's colour (turn or straight) is knowable the instant a cell is settled, so the solver checks it immediately, the same way this site's own Masyu solver checks its own pearls as it goes. A circle's number is a different kind of fact: an arm's length depends on where the next turn falls, which is not decided yet while the search is still filling in earlier cells, so it can only be checked once a whole candidate loop has closed. That makes the number far weaker at narrowing the search than the colour is, and a first version measured the consequence directly: with no limit in place, a single attempt at 7 squares a side ran past two minutes during development before it was stopped by hand, because a weakly-clued grid — exactly what removing circles produces — can force many complete, colour-valid loops to be checked in full before two are found whose numbers also agree. Two independent budgets fixed it: a hard cap on how many search steps any one solve attempt may take, so a single call can never hang no matter what calls it, and a budget of four million search steps across the circle-removal pass itself, so a run of many near-the-cap checks cannot each spend the full budget in turn. Removing a circle is safe to stop early at any point, for the same reason thinning a country-road puzzle's numbers is: a circle is only ever taken away once its absence is proved to still leave one answer, so stopping early yields a puzzle with a few more circles than the minimum, never a wrong one. Measured with both budgets active, worst case over at least 40 seeded builds was 55 milliseconds at 5 squares a side, 2,200 milliseconds at 6, and 2,665 milliseconds at 7 — while 8 squares a side, measured the same way, peaked at 9,753 milliseconds, which is why the grid stops at 7.
Randomness and fairness
Which shape the loop takes while it is first drawn, and the order circles are tested for removal afterward, both come from your browser's cryptographic random source. Giving a seed replaces that source with a repeatable one, so the same puzzle can be printed again; the seed is 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 7 squares a side. Measured directly, an 8x8 grid peaked at 9.75 seconds to settle even with both search budgets in place, which is too slow for a page a person is waiting on.
- The loop does not have to visit every cell, only every circled one, so two puzzles of the same size can end up with loops of noticeably different lengths.
- Difficulty is not graded — a grid can be settled from a handful of well-placed circles or need several worked out together, and there is no control over which.
Privacy and your data
The loop is drawn, clued and checked for a single answer entirely in your browser. Nothing you type as a seed, and no puzzle made from it, leaves the device.
Frequently asked questions
- What does a circle's number actually count?
- Not the whole loop, and not a distance to the grid's edge — only the combined length of the two straight stretches the loop makes leaving that exact circle, each counted out to the next cell where it turns. A short number means a turn is close by on both sides; a long one means at least one side runs a long way straight before it bends.
- What's actually different between this and this site's Masyu (pearl loop) generator?
- Both draw one loop and clue some of the cells it passes through with a black-or-white circle for turn-or-straight. Masyu's white pearl adds its own extra condition — a turn has to sit on at least one immediately adjacent cell — and carries no number at all. Shingoki's white circle means only "straight," full stop, but every circle here carries a number measuring how far the loop runs before it next turns, which Masyu's pearls never do.
Related generators
- Pearl Loop Puzzle GeneratorPrints a pearl loop puzzle — one closed circuit obeying every white and black pearl it passes through — with exactly one answer.
- Slitherlink Puzzle GeneratorPrintable Slitherlink loop puzzles with every clue proved necessary and exactly one closed loop satisfying them.
- Arrow Loop Puzzle GeneratorPrints an arrow loop puzzle — every square is shaded or on one closed loop, and each numbered arrow counts the shaded squares in its direction — with exactly one answer.
- Country Road Puzzle GeneratorDraw one loop along the grid lines that puts every numbered square inside it, where each number counts the inside squares it can see along its own row and column.
- Numberlink Puzzle GeneratorPrints a grid of numbered endpoints — connect each matching pair with a path that never crosses another, filling every square — with exactly one answer.
- Printable Puzzle Book GeneratorBuilds a printable book of up to 250 sudoku, mazes, word searches, nonograms, fill-in crosswords and codewords — sectioned, ramped from gentle to hard, numbered front to back, with an answer key that matches.