How to Solve Loop Puzzles: The Inside and Outside Method

This article was written with AI and may contain mistakes. Found one? Tell us.

By Riddle10 Editorial Published 10 min read

To solve a loop-drawing puzzle, decide for each cell whether it lies inside or outside the loop, because a clue simply counts how many of its four neighbours sit on the other side. Start from the zeros and the corners, spread inside and outside from cell to cell, and the single closed loop appears as the outline of the inside cells.

Below are the rules, the quick opening patterns, the inside and outside method, one puzzle solved in eight short steps and a slightly bigger one to try, answer included.

What is a loop-drawing puzzle?

A loop-drawing puzzle is a grid of dots with numbers in some of the square cells between them. You join neighbouring dots with short straight lines to make one closed loop. The loop never crosses itself, never branches and never touches itself at a dot.

A number inside a cell says how many of that cell's four sides are part of the loop. A cell with no number can have any count. A well-made puzzle has exactly one loop that fits every number.

What do the numbers tell you?

Each number is a count of sides, and some counts give you lines straight away. The table compares the four clue values.

ClueSides of the cell on the loopQuick deduction
0NoneCross out all four sides
1OneIn a grid corner, neither outer side is used
2TwoLook at the neighbours before deciding
3ThreeIn a grid corner, both outer sides are used

The corner rules come from one simple fact. The dot at the very corner of the grid touches only two sides. A loop that reaches that dot must use both of them, and a loop that misses it uses neither.

That gives the most useful rule of all, the dot rule: every dot has either no lines or exactly two. If a dot already has two lines, cross out its other sides. If it has one line and only one open side, the loop must continue along that side.

What is the inside and outside method?

Pencil marks on sides are hard to keep track of. A cleaner way is to label cells instead. Every cell is either inside the loop or outside it, and the space beyond the grid edge counts as outside.

Here is the key idea. The loop runs along a side exactly when the two cells sharing that side are on different sides of the loop. So a clue of 2 means exactly two of the cell's four neighbours have the opposite label to the cell itself. Edge cells count the space beyond the border as an outside neighbour.

Two more facts finish the method:

  • All the inside cells form one connected group, joined side to side. A separate pocket of inside cells would need a second loop.
  • All the outside cells connect to the border in the same way.
  • Two inside cells may not touch only at a corner. If two inside cells meet corner to corner, at least one of the two cells beside both of them must be inside too. Otherwise the loop would touch itself at that dot.

When every cell has a label and these rules hold, draw the loop along every side where an inside cell meets an outside cell. You do not need to track individual lines.

What is the step-by-step method?

  1. Label the zeros. A 0 cell has the same label as all four neighbours. On the border, that label must be outside.
  1. Use the corners. A 1 in a grid corner must be outside, since an inside corner cell would already differ from two border neighbours.
  1. Count around each clue. When a clue cell has a label, count how many known neighbours differ. If the count is already met, every unknown neighbour matches the cell. If the unknowns are all needed to reach it, they all differ.
  1. Spread from new labels. Each new label touches up to four clues. Check each of them before moving on.
  1. Keep one inside group. An unlabelled cell that would create a separate inside pocket must be outside.
  1. Draw and check. Trace the outline of the inside cells and count the sides around every clue.

How does labelling crack a four by four loop puzzle?

Here is an original puzzle. Row 1 is the top row and column 1 is on the left. An empty cell has no clue.

Col 1Col 2Col 3Col 4
Row 11321
Row 213
Row 321
Row 400

We checked by computer, trying every way to label the sixteen cells, that exactly one single loop fits these clues. Try it before reading on.

Step 1: the zeros. The 0 in the bottom right corner borders the outside on two sides, so it is outside, and so are its neighbours in row 3, column 4 and row 4, column 3. That second cell is also a 0, so row 3, column 3 and row 4, column 2 are outside too.

Step 2: the 1 in row 3, column 4. It is outside. Its border side, the cell below it and the cell to its left are all outside, so the one difference it needs must be the cell above. Row 2, column 4 is inside.

Step 3: the 2 in row 3, column 3. It is outside, and the cells below it and to its right are outside. It needs two differences, so the cell above it and the cell to its left are both inside: row 2, column 3 and row 3, column 2.

Step 4: the 3 in row 2, column 4. It is inside. The border and the cell below it are outside, which gives two differences. The cell to its left is inside. The third difference must be the cell above, so row 1, column 4 is outside.

Step 5: along the top row. The 1 in row 1, column 4 is outside and already differs from the inside cell below it, so its left neighbour matches it: row 1, column 3 is outside. That cell is a 2 with outside cells above and to the right and one inside cell below, so its left neighbour must differ. Row 1, column 2 is inside.

Step 6: the corner 1. If the top left cell were inside, its top and left border sides would already make two differences, one too many. So it is outside. It already differs from the inside cell to its right, so the cell below it, row 2, column 1, is outside.

Step 7: the 3 in row 1, column 2. It is inside, with outside cells above, to the left and to the right. That is three differences, so the cell below it, row 2, column 2, is inside.

Step 8: finish. The 1 in row 2, column 1 is outside and already differs from the inside cell to its right, so row 3, column 1 is outside. The last cell, row 4, column 1, has no clue. If it were inside it would be a pocket cut off from the other inside cells, so it is outside.

Here is the result, with a filled square for each inside cell and a dot for each outside cell.

Col 1Col 2Col 3Col 4
Row 1·■··
Row 2·■■■
Row 3·■··
Row 4····

The loop is the outline of the five filled cells, a shape like a sideways letter T, and it runs along twelve sides of the grid. Check each clue: the 3 in row 1, column 2 has its top, left and right sides on the loop, and the zeros touch none. No two inside cells touch only at a corner.

Why does every loop have an even number of sides?

Colour the dots of the grid like a chessboard. Each step along a side moves from one colour to the other, so a loop that returns to its starting dot must take an even number of steps. That is why the worked loop has twelve sides and why no loop can ever have an odd count.

Chess offers a close relative of this colouring trick. A knight that visits every square once and hops back to its starting square has made a closed tour, which in network language is a Hamiltonian cycle [1].

A paper published on 9 May 2007 studied closed knight tours inside a cube of cells with n cells along each edge [1]. It states that for n of 4 or more, such a cube has a closed tour exactly when n is even [1]. The odd cubes are ruled out by a two-colour parity argument [1].

This next point is our own comparison, not something the paper says: that argument is a similar kind of idea to the dot colouring above.

How do loop puzzles connect to Hamilton cycles?

A Hamilton cycle is a closed route through a network that passes every point exactly once. The loop in this kind of puzzle is a closed route through the network of dots, but it is free to skip dots, so it is a cycle that need not be a Hamilton cycle.

One well-known closed-route problem is the travelling salesman problem. In plain terms, it asks for the shortest closed route through every point of a network.

A paper published on 21 June 2011 opens by naming the travelling salesman problem among the most basic NP-complete problems about networks [2].

The paper itself studies networks where each point has exactly three links [2]. For those, it describes a procedure that writes out all the Hamilton cycles in time of order 1.276 to the power of the number of points [2]. It begins from one fixed Hamilton cycle, keeps the network unchanged and walks along that cycle, growing partial cycles as it goes [2].

At many of those points only one option is left, which keeps the search small [2].

As our own comparison, not the paper's, solving a loop puzzle by hand can feel similar. Look for the places where the dot rule or a clue leaves just one choice.

What are the most common mistakes?

  • Closing a small loop early. The puzzle wants one loop. If joining two line ends would close a loop while other lines still exist, that side must be crossed out.
  • Forgetting the border. In the inside and outside method, the space beyond the edge is always outside.
  • Reading a 2 as two neighbours that match. A 2 counts neighbours on the opposite side, not the same side.
  • Leaving a dead end. A dot with exactly one line always needs a second.
  • Skipping the final count. Count the sides around every clue once the loop is drawn.

How do you restart when the loop stalls?

  • Switch methods. If side marks stall, label cells inside and outside, and the other way round.
  • Look for an unlabelled cell between known inside cells and known outside cells. Try each label in your head and see which breaks a clue.
  • Check connection. A group of outside cells cut off from the border, or a pocket of inside cells cut off from the rest, means a label is wrong.
  • Revisit every clue next to a cell you labelled in your last pass.

Can you solve this practice puzzle?

Here is a five by five puzzle with twelve clues. Draw one closed loop so that every number counts its sides correctly.

Col 1Col 2Col 3Col 4Col 5
Row 12
Row 2113
Row 3222
Row 4100
Row 500

A hint: start at the bottom. The 0 in row 5, column 2 sits on the border, so it and all its neighbours are outside, and the zeros in row 4 then spread outside labels upwards.

Answer: nine cells are inside, and the loop is their outline, fourteen sides long. We checked by computer that this is the only loop that fits.

Col 1Col 2Col 3Col 4Col 5
Row 1■■■··
Row 2■■■■·
Row 3■■···
Row 4·····
Row 5·····

Check the 3 in row 2, column 4: it is inside, with outside cells above, below and to the right, so the loop uses three of its sides.

Ready for more grid logic? In this riddle, nine glass tiles wait to be lit, and you must work out the one tap that lights them all.

References

  1. DeMaio, J. (2007, May 9). Which Chessboards have a Closed Knight's Tour within the Cube?. The Electronic Journal of Combinatorics, 14(1), R32. DOI 10.37236/950
  2. Gebauer, H. (2011, June 21). Enumerating all Hamilton Cycles and Bounding the Number of Hamilton Cycles in 3-Regular Graphs. The Electronic Journal of Combinatorics, 18(1), P132. DOI 10.37236/619

loop puzzles loop drawing puzzles logic puzzles grid puzzles step by step solving methods

More reading