Slitherlink, Explained

After reading this you will understand how a slitherlink loop is built, why each numbered clue constrains the edges around it, and how a generator strips clues while keeping the solution unique.

What a slitherlink puzzle is

A slitherlink starts as a grid of dots. Between neighboring dots run short line segments called edges. Your job is to darken some of those edges so they form exactly one closed loop: a single unbroken chain that returns to its start, never crosses itself, and never branches.

The clues live inside the cells. A clue is a number from 0 to 3. It counts how many of that cell's four surrounding edges belong to the loop. A 0 means none of the four edges are used. A 3 means exactly three of them are. A cell with no number tells you nothing directly, but the loop still has to pass around it in some consistent way.

Consider a single 3 in the corner of a 5×5 grid. Three of its four edges are in the loop. The loop enters the cell's border, wraps three sides, and leaves. That one clue already forces a small hook of the loop and often forces neighboring edges too. This chaining of small forced moves is the whole pleasure of the puzzle.

When to use it, and when not

Slitherlink suits solvers who like spatial reasoning over arithmetic. Unlike sudoku, there is no counting to nine and no writing candidates in every cell. You reason about edges and corners. That makes it a good fit for a mixed puzzle sheet where you already have number-placement puzzles and want variety.

Use a 5×5 or 6×6 grid for a classroom warm-up or a first exposure. These solve in a few minutes and rarely need advanced technique. Use 9×9 or 10×10 for a challenge that holds attention for 20 minutes or more.

For a beginner's first puzzle, choose the easy setting so most cells keep a number. Dense clues mean more forced moves and fewer moments where the solver stalls with no visible next step.

Avoid slitherlink if your audience wants a quick, low-friction fill-in. The loop constraint takes a short lesson to internalize, and a solver who has never seen one may quit before the first deduction lands.

The counting rule and why it works

The clue rule is a simple sum. For a cell, let each of its four edges be 1 if the loop uses it and 0 if it does not. The clue equals the total.

c = e_{\text{top}} + e_{\text{right}} + e_{\text{bottom}} + e_{\text{left}}

Here c is the clue number and each e is 0 or 1. Because there are four edges, c ranges from 0 to 4, but a valid loop never uses all four edges of one cell (that would form a tiny separate square, not part of one connected loop), so clues stay in the range 0 to 3.

A second rule governs the dots, not the cells. At every dot, the number of loop edges meeting there must be 0 or 2. It can never be 1 (a loose end) or 3 (a branch). This "even at every corner" condition is what forces a single closed curve. The clue counts guide you; the corner parity keeps the path legal.

Counting the total edges helps you see the size of the search space. A grid of n \times n cells has 2n(n+1) edges. For a 5×5 grid that is 2 \cdot 5 \cdot 6 = 60 edges, each on or off, so 2^{60} raw combinations before any rule applies. The loop and corner rules cut that to a handful, and the clues pin it to one.

How the generator builds a unique puzzle

The generator does not scatter numbers and hope. It works backward from a finished loop.

  1. Draw one random closed loop on the empty dot grid. This is the intended solution, guaranteed to be a single non-crossing loop.
  2. Compute every clue. For each of the n^2 cells, count the loop edges around it and write that number in. This gives a fully clued board that trivially has the loop as a solution.
  3. Remove clues one at a time. After each removal, run a backtracking solver on the reduced board. If the solver finds the solution is still unique, the removal stays. If a second solution appears, put the clue back.
  4. Stop when no further clue can be removed without creating a second solution. What remains is a minimal puzzle for the chosen difficulty.

The difficulty setting changes step 3. On easy, the generator removes fewer clues and leaves the board dense. On hard, it strips every clue the solver can prove redundant, so you are left with the sparsest board that still forces one answer. Fewer clues means longer deduction chains and more places where you must look two or three moves ahead.

The backtracking solver is the guarantee. Every puzzle shown has been solved by machine and confirmed to have exactly one loop. That is why a generator can promise uniqueness where hand-made puzzles sometimes fail.

Reproducing the demo puzzle

The demo button uses the defaults: a 5×5 grid at medium difficulty. Here is the shape of the reasoning it produces, using a corner as an example.

  1. Find a 0. Every edge around a 0 cell is off. Cross out all four. This is the safest first move on any board, because it removes possibilities with zero risk.
  2. Find a 3 next to that 0. The shared edge between them is already off (the 0 forbade it), so the 3 must use its other three edges. Darken them.
  3. Check corner parity. Each darkened edge ends at a dot. Any dot now touching one loop edge must eventually touch a second, so extend the loop from those dots.
  4. Move to a 1 in a corner of the grid. A grid corner cell has two edges on the outer border. If parity has already forced one of them off, the 1's single edge is pinned to a known side.
  5. Continue alternating between clue counts and corner parity until the loop closes. On a 5×5 the loop uses roughly 20 to 30 of the 60 edges.

The key habit is to switch between two questions: "Does this cell's clue force an edge?" and "Does this dot's parity force an edge?" Every deduction comes from one or the other.

Reading the loop density

The fraction of edges the loop uses tells you how tight the puzzle feels. Across many random 5×5 puzzles, the loop uses about 40% of the 60 edges, so around 24 darkened edges. Larger grids trend to a slightly lower fraction because interior room lets the loop wander with fewer sharp turns.

Total edges grow as 2n(n+1); a typical loop uses roughly 36 to 40 percent of them.

You can check the total edge column yourself. For 8×8, 2 \cdot 8 \cdot 9 = 144. For 10×10, 2 \cdot 10 \cdot 11 = 220. The loop-edge column is an average from sampled puzzles, so any single puzzle you generate will land a few edges above or below.

A 6×6 grid has 84 edges and 36 cells. On easy, roughly 28 of the 36 cells keep a clue; on hard, roughly 14 remain. Fewer clues force longer deduction chains.

Common mistakes when solving

Three errors account for most stuck boards.

Ignoring the corner parity rule
Solvers count clue edges but forget that every dot needs an even number of loop edges. A dot with one edge in and no legal second edge means an earlier move was wrong.
Building a small closed loop early
It is tempting to close a neat little square once a few edges line up. But the puzzle demands one loop covering the whole answer. A premature closed sub-loop is always illegal, even if every nearby clue is satisfied.
Treating blank cells as forbidden
A cell with no number is unconstrained. The loop may use zero, one, two, or three of its edges. Do not read a blank as a 0.

If you reach a contradiction, do not erase the whole board. Backtrack to your last guess. Slitherlink solved cleanly needs no guessing at all, so a forced contradiction usually means a single earlier edge was marked wrong.

Related puzzle generators

If you like loop and constraint logic, these tools on this site work the same way, building a solution first and then verifying uniqueness. The closest cousin by structure is the Hashiwokakero (Bridges) Generator, which also connects points into a single connected network. For number placement, try the Sudoku Generator or the arithmetic Kakuro Generator. For visual grids, the Nonogram Maker turns a drawing into row and column clues. Other Latin-square variants include the KenKen (Calcudoku) Generator, the Futoshiki inequality generator, the Skyscrapers Puzzle Generator, and the shading puzzle Hitori Generator.

Frequently asked questions

Why can a clue never be 4?

A cell whose four edges are all in the loop would be a tiny closed square. That is a separate loop, which breaks the single-loop rule. So the highest legal clue is 3, and the generator never produces a 4.

Is every slitherlink solvable without guessing?

Every puzzle from this generator has exactly one solution, verified by the solver. Whether you can reach it by pure logic depends on difficulty. Easy and medium boards yield to forcing moves. Hard boards may need long chains that feel like guessing but are still deductions if you follow them carefully.

How many puzzles can a 5×5 grid produce?

The number of distinct single loops on a 5×5 dot grid is large, and each loop yields one fully clued board, then many minimal puzzles after clue removal. In practice the count is far beyond what you would ever print, so repeats are effectively impossible.

Can I print the solution?

Yes. You can print a clean sheet with or without the solved loop, and export the image as PNG or SVG for a worksheet or slide.

What size should I pick for a first-timer?

Start at 5×5 on easy. It has 60 edges and keeps most of its 25 clues, so almost every move is forced and the loop closes in a few minutes.