GenerateRandomSearch

Kuralin Puzzle Generator

Kuralin is a loop puzzle where the circles keep score. You draw one loop through cell centres; every cell the loop misses is black. Circles sit on grid lines: a circle between two cells touches those two, and one on a corner touches the four around it. A black circle touches more black cells than white, a white one more white than black, and a grey one the same of each. This makes fresh puzzles at 5, 6 or 7 squares a side, each with a single answer proved from the printed circles alone, and prints the puzzle and answer.

What this generator does

Draws a loop covering at least 55% of the cells, then places black, white and grey circles where they rule out other loops, and removes any circle not needed for one answer. Slitherlink draws the loop along cell edges; here it runs through cell centres and the circles count colours, not lines.

How to use this tool

  1. Choose the grid size and press Make a puzzle. Add a puzzle code to make the same puzzle again.
  2. Draw the loop on paper or a printout and blacken the cells it misses.
  3. Press Show the answer to see the loop and the black cells.

Understanding the controls

Grid
5, 6 or 7 squares a side. Bigger grids need more circles; a 7 × 7 usually has 11 to 17.
Puzzle code
Leave empty for a new puzzle from the browser's secure generator. With a code, the same code and size make the same puzzle again; the code is a seed, not a secret.

Worked examples

Code harbour, 6 × 6
13 circles (1 black, 6 white, 6 grey); the loop passes through 22 of the 36 cells.
Code harbour, 7 × 7
13 circles (2 black, 7 white, 4 grey); the loop passes through 36 of the 49 cells.

Common use cases

  • A loop puzzle for solvers who enjoy Slitherlink and Masyu-style logic
  • Printed puzzle sheets with answers
  • A shared puzzle for a class from one code

How this generator works

The solver decides cells in reading order. Each cell picks whether its loop line runs right and whether it runs down, so that with the lines coming in from the left and above it has two lines or none. Paths are joined with a union-find structure; a loop may close only when it holds every line drawn so far, after which no new line is allowed. Each circle is checked the moment the last cell it touches is decided. To make a puzzle the same search runs in a shuffled order with a minimum loop length and draws one loop; circles are then added at points where a second answer would colour the touched cells differently, until only one answer remains, and each circle is removed again if one answer still remains without it. A search that reaches its step limit proves nothing. The rules, including what a circle touches, were read from Nikoli's page and checked against Nikoli's own worked example: from that example's six circles the solver finds exactly one loop, the published one. Afterwards the loop is traced line by line from the answer and every circle recounted, and the count is re-run from the printed circles.

Randomness and fairness

The drawn loop and the choice of circles come from a random sequence: the browser's secure generator, or a seeded one when you give a code. A code repeats a puzzle while the generator is unchanged. Codes are deterministic, not cryptographic.

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

Assumptions this tool makes

  • Nikoli's published rules for Kuralin, restated on the page.
  • Circles sit only inside the grid: on a line between two cells or a corner shared by four. None sit on the outer border.

Limitations and good to know

  • 5 × 5 to 7 × 7 only.
  • Kuralin puzzles here are not graded for difficulty, and more circles does not mean easier.
  • Loops are drawn at random with at least 55% of cells, not designed for a theme.

Common mistakes

Counting the eight cells around a circle
A circle touches only the cells sharing its point: two for a circle on a line, four for one on a corner.
Drawing two loops
There is exactly one loop. If two pieces close separately, one must open up.
Leaving a white cell off the loop
Every cell is either on the loop or black — there are no unused white cells.

Practical tips

  • A black circle on a line between two cells makes both cells black at once.
  • A grey circle on a line means exactly one of its two cells is black.
  • A corner cell is on the loop only if both of its neighbours are, since the loop needs two ways in and out.

Privacy and your data

Kuralin puzzles are built in your browser. With analytics consent, a count records that a puzzle was made or failed; the circles, the loop and any puzzle code are never sent.