GenerateRandomSearch

Pearl Loop Puzzle Generator

A pearl loop asks for one closed circuit drawn through the centres of the squares, going only up, down, left and right and never crossing itself. Two kinds of pearl tell you how the loop must behave where it meets them: at a white pearl it runs straight through, and turns in at least one of the two squares beside it; at a black pearl it turns, and then runs straight on through both squares it leaves into. The loop need not visit every square, which is what makes the pearls worth reading carefully. Every grid here is checked to have one answer and no other.

What this generator does

Draws a random closed loop, marks every pearl that loop would earn, then takes pearls away one at a time — keeping a removal only while a single loop survives.

How to use this tool

  1. Choose a grid size and how much of it you would like the loop to cover.
  2. Print or copy the grid; the circles are the pearls, hollow for white and filled for black.
  3. Draw one closed loop through square centres, never crossing itself and never branching.
  4. Run straight through each white pearl, turning just before or just after it.
  5. Turn at each black pearl, then carry straight on for a full square either side of it.
  6. Show the answer to check the finished loop.

Understanding the controls

Grid
Five to seven squares a side. Seven is the ceiling and it is a measured one: proving an eight unique takes about half a minute.
Loop
How much of the grid the loop should cover. A longer loop gives a fuller drawing and takes longer to find, so it is offered up to six squares a side and the shorter one up to seven.
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 for anyone who has run out of the usual grid ones
  • A printable page for a puzzle club, a classroom or a newsletter
  • A short logic puzzle that needs no arithmetic whatever
  • A gentler companion to a link-the-dots loop puzzle
  • Reprinting the identical grid later from its seed

How this generator works

The awkward part of a loop puzzle is that being a single closed circuit is a property of the whole drawing, which no square can check on its own. That is handled here by settling squares in reading order, so that by the time a square is settled its whole degree is known — its left and upper line ends were fixed by earlier squares, and it chooses its right and lower ones itself. Every square therefore carries no line or exactly two line ends all the way through, which makes the drawing a collection of paths and circuits at every moment, and leaves one question: when may a circuit close? Exactly once, with no line end left pointing into unsettled ground, with every drawn square inside it, and with every pearl inside it too; after that every remaining square must stay empty. The pearls are placed by reading them off a finished loop and then thinned one at a time, each removal kept only while a solver shown the pearls alone still finds a single answer.

Randomness and fairness

The loop, and the order the pearls are taken away in, come from your browser's cryptographic random source. A seed swaps that for a repeatable one so the same puzzle comes back. A seed is for reproducibility, not cryptographic strength: anyone with the same seed gets the same grid, so it is not a secret.

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 the longer loop at six — both measured limits, not preferences.
  • Difficulty is not graded. A loop with one answer can be led by its pearls from the first move, or need a corner of the grid resolved before it opens up.
  • Most random loops are not pinned down by their own pearls, so the builder tries several and the time taken varies.
  • A square with no pearl is unconstrained; only the printed pearls are promises.

Privacy and your data

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