Key takeaways
- A cell with only two open sides must use both, so start in the corners.
- Only 1 and the highest number can end the line, so never leave a cell with one way in.
- If the distances between consecutive numbers add up to the cells minus one, every stretch takes a shortest route.
- A pocket of empty cells can only be filled between two consecutive numbers that both sit beside it.
- On a chessboard colouring, a stretch through an odd number of cells joins two numbers of the same colour.
To solve a number path puzzle, start where the line has the fewest choices. A corner, or any other cell with only two open sides, has to use both of them. The line can never leave a cell with a single way in, because only 1 and the highest number can end it, and walls count as edges of the board. Then come three checks that take a little counting. Add up the steps between consecutive numbers, keep every pocket of empty cells fillable in order, and colour the board like a chessboard to test the pockets only one stretch of the line can reach.
We make Pathfold here at 9io. It’s a daily number path puzzle for iPhone and iPad, free on the App Store. You draw a single line from 1 to the highest number, through every number in order, filling every cell exactly once, moving up, down, left or right and never through a wall. Every puzzle has exactly one solution, and you can always reach it by reasoning.
This guide takes the six techniques in the order you’ll use them, each on a small board of our own, then matches them to Pathfold’s hints and ends with a checklist. A short brute-force solver written for this post checked every board: each has exactly one solution, and every move ruled out below leads to none. Pathfold’s guide page covers the game’s modes and settings.
The rules of a number path puzzle
The line starts on 1, passes through 2, 3 and the rest in order, and ends on the highest number, so you connect the numbers in order with one line that fills every square. In Pathfold the highest number can only be entered as the very last cell, and a thick bar on a grid line is a wall the line can’t cross.
The numbers are checkpoints. They don’t say how many cells lie between them, so the stretch from 4 to 5 might be one step long or twenty. A line through every cell of a grid is what mathematicians call a Hamiltonian path,1 and our post on the maths of one-line puzzles covers where that leads.
In Pathfold you put a finger on the line’s end and drag. To take steps back, drag back along the line, or tap any cell of it to cut the line back to there.
In the boards below, a dot is an empty cell and a thick bar (┃ or ━━━) is a wall. Thin lines are the path, and ● marks the line’s end.
Start with corners and cells that have two open sides
Every cell except 1 and the highest number sits in the middle of the line, so the line enters it from one side and leaves by another. A cell with exactly two open sides must therefore use both. Corners are the first you’ll see, and walls and the line itself make more as you go. 1 and the highest number are the line’s ends, so each takes a single link.
Board A is a 4 × 4 with three numbers.
· · · ·
· · 2 ·
1 · · 3
· · · ·
Each corner has two open sides, so each holds an elbow of the line. The bottom-left elbow runs into 1, and since 1 is an end, that’s its only link. The cell above 1 then has two open sides left, the corner above it and the cell to its right, so it uses both. The same happens around 3. Before you draw anything, 10 of the line’s 15 links are fixed.
· ─ · · ─ ·
│ │
· ─ · 2 ─ ·
1 · · 3
│ │
· ─ · · ─ ·
One more rule finishes the board: the line can’t close into a loop. The top-left piece runs from the top edge round the corner and into the second row. If its top end turned down, it would meet its own other end, so it carries on to the right, and the same rules then settle every link that’s left.
· ─ · ─ · ─ ·
│ │
· ─ · 2 ─ ·
│ │
1 · · 3
│ │ │ │
· ─ · · ─ ·
Never leave a dead end
A cell with one open side can only be an end of the line, and the ends are taken by 1 and the highest number. So a move is wrong if it leaves any other cell with a single way in. Before each step, look at the cells around the line’s end. If one is down to two open sides, one of them the line’s end, the line has to go into it now. If two cells are like that, the line can’t serve both, so step back.
On board A, say you’ve drawn from 1 into the corner, along the bottom and up two cells.
· · · ·
· ● 2 ·
│
1 · · 3
│ │
· ─ · · ·
2 is right beside the line’s end, and it’s tempting. But the cell to the end’s left has two open sides left, the corner above it and the line’s end. Step onto 2 now and that cell has one way in, so the line turns left first and reaches 2 the long way round, across the top. The same check sent 1 down into the corner at the start, since going up or right would have left the corner with a single way in.
Use walls like the edge of the board
A wall takes an open side away from each of the two cells it separates, just as the edge of the board does. A cell beside a wall on the board’s edge works like a corner, and a cell between two walls is a corridor. Walls also stretch distances, since two cells side by side with a wall between them are no longer one step apart. Board B has three walls.
· · · · ·
· 3 · · ·
━━━
· 2 · · ·
· ┃ 1 · · ·
━━━
· 4 · · 5
The wall on 1’s left leaves the cell beside it only up and down, and below that cell is the corner next to 4. So the bottom of the left column is a corridor into 4, and the line has to come down it on its way from 3 to 4. Meanwhile 3 sits right above 2, behind a wall.
- From 1, the line can go up to 2 or right. If it went right, 2 would have two free sides left, its left and its right, and would have to use both. The left one leads down the corridor to 4, putting 4 straight after 2 with 3 skipped. So the line goes up to 2.
- From 2 the wall blocks 3. Going left would take the cell at the top of the corridor, and the line would then have to run down to 4 too early or leave the corridor a dead end. So the line goes right.
- Now the cell below the line’s end has a wall under it and 1 on its left.
· · · · ·
· 3 · · ·
━━━
· 2 ─ ● · ·
│
· ┃ 1 · · ·
━━━
· 4 · · 5
That cell’s only open sides are the line’s end and the cell to its right, so the line drops into it now, before it becomes a dead end. Here is the finished line.
· ─ · · ─ · ─ ·
│ │ │ │
· 3 ─ · · ─ ·
│ ━━━ │
· 2 ─ · · ─ ·
│ │ │ │
· ┃ 1 · ─ · ─ ·
│ ━━━
· ─ 4 ─ · ─ · ─ 5
Count the steps between consecutive numbers
On a board of n cells the line takes exactly n − 1 steps. Each stretch between consecutive numbers needs at least the fewest steps between them, round walls and other numbers. Every step changes colour on a chessboard pattern (more on that below), so a detour from a shortest route adds an even number of steps. Add up the shortest distances from 1 to 2, 2 to 3 and so on, and take the total from n − 1. What’s left is the board’s spare steps, always an even number. With none spare, every stretch takes a shortest route, and where nothing is in the way, a shortest route never moves away from its target.
Board C looks wide open.
· · · · 4
· · · · ·
· · 1 · 2
· 3 · · ·
5 · · · 6
The distances are 2, 4, 6, 8 and 4, which add up to 24, and the board has 25 cells, so there are no spare steps. All four first moves from 1 pass the dead-end and pocket checks, and only one starts a shortest route to 2, the step right. From 2, the stretch to 3 can only go down and left, and the cell left of 2 is taken, so it drops a row and runs left to 3. The stretch from 5 to 6 runs straight along the bottom. The stretch from 3 only goes up and right, so it can’t reach the top-left corner, and the stretch from 4 to 5, which only goes left and down, must sweep the whole top row before turning down the left side. The stretch from 3 to 4 takes the cells that are left.
· ─ · ─ · ─ · ─ 4
│ │
· · ─ · ─ · ─ ·
│ │
· · 1 ─ · ─ 2
│ │ │
· 3 ─ · ─ · ─ ·
│
5 ─ · ─ · ─ · ─ 6
Spare steps are worth counting in Pathfold. In 40 of the 100 levels of its Gentle pack, all 5 × 5, there are none, and 32 more have two, which means a single detour. The table shows the same count for the 1,300 dailies bundled with Pathfold 1.0, with each day’s board and label from the game’s source.
| Day | Board | Label | Numbers (median) | Boards with walls | Spare steps (median) |
|---|---|---|---|---|---|
| Monday | 6 × 6 | Easy | 11 | 42% | 6 |
| Tuesday | 6 × 6 | Medium | 8 | 57% | 10 |
| Wednesday | 6 × 6 | Medium | 8 | 54% | 10 |
| Thursday | 7 × 7 | Medium | 12 | 44% | 10 |
| Friday | 7 × 7 | Hard | 10 | 50% | 12 |
| Saturday | 7 × 7 | Hard | 10 | 49% | 12 |
| Sunday | 8 × 8 | Expert | 14 | 46% | 14 |
We counted these by decoding the bundled puzzles and measuring each shortest distance round walls and other numbers. They say nothing about how people play.
Don’t cut off a pocket the line can’t fill
The line fills the empty cells one stretch at a time. A stretch only passes through empty cells, so a pocket (a group of empty cells closed off by the line, walls and numbers) can only be filled by a stretch whose two numbers both sit beside it. The line’s end counts as the number it last reached. After each move, check that the empty cells still hang together, since the line goes into them from its end and never comes back, and that every pocket has two consecutive numbers beside it.
On board D, 6 sits on 1’s left, but 6 comes later, so the line can only go up, right or down.
· 3 · 2 7
· 4 · · ·
· · 5 · ·
6 1 · · ·
· · · · ·
Going down passes the bottom-left corner, whose only other neighbour is 6. The corner would become a pocket beside just the line’s end and 6, which aren’t consecutive. The line could step into it, but its only way out would be onto 6, long before 6’s turn. Going up passes every check so far, and the colours show why it fails too.
Check the colours with the parity rule
Colour the board like a chessboard, with the top-left corner dark. Each step lands on the other colour, so a stretch through an odd number of cells joins two numbers of the same colour, and a stretch through an even number joins two of different colours. The whole line follows the same rule. On a board with an even number of cells, 1 and the highest number sit on different colours, and on an odd board both sit on the corners’ colour. That condition is where the classic 1982 paper on Hamiltonian paths in grids begins,2 and all 9,400 puzzles bundled with Pathfold 1.0 meet it.
Back on board D, here is the line after a step up from 1, with ○ marking a pocket.
○ 3 · 2 7
○ 4 · · ·
○ ● 5 · ·
│
6 1 · · ·
· · · · ·
The pocket has 3, 4, 6 and the line’s end beside it, and the only consecutive pair there is 3 and 4, so the stretch from 3 to 4 would have to fill all three cells. Three is odd, so 3 and 4 would need the same colour. But 3 sits next to the dark top-left corner, so it’s light, and 4 sits diagonally from that corner, so it’s dark. Up is out, and the line goes right.
· ─ 3 ─ · ─ 2 7
│ │ │
· ─ 4 ─ · · ·
│ │ │
· ─ · ─ 5 · ·
│ │ │
6 1 ─ · ─ · ·
│ │
· ─ · ─ · ─ · ─ ·
Pathfold’s exact solver, which proves each puzzle has a single solution, makes this check at every step. The solver behind its hints doesn’t use parity, and every bundled puzzle can be solved without it, so in Pathfold parity is a shortcut: one count settles what a look several steps ahead would also find.
How Pathfold’s hints name these steps
A hint in Pathfold finds the next logical step from your board, highlights the cells involved and explains it in a sentence or two. Tap Hint again to apply it. If your line has gone wrong, the hint points to the mistake first. Its titles line up with this guide’s techniques.
| Technique | Pathfold’s hint title | What the hint says, for example |
|---|---|---|
| Only one legal move | One way on | “Walls, the line itself and the numbers still to come leave just one way from here: down.” |
| Corners and two-way cells | A corridor | “The highlighted cells have only two open sides each, so the line must run through them, and only from here.” |
| Dead ends | Mind the dead ends | “Going right would leave the highlighted cell with only one way in: a dead end.” |
| Empty cells cut in two | Don’t split the board | “Going right would cut the empty cells into two parts, and one line can’t fill both.” |
| Pockets and number order | Numbers in order | “Going left would leave no way to reach 4.” |
| Following a move ahead | Think ahead, Look further ahead | “If the line went up, it would be forced along the dotted cells into a dead end.” |
Counting and parity have no hint of their own, because the hint solver never needs them.
A checklist for any number path puzzle
Run through these in order whenever the next move isn’t obvious.
- Draw the elbow in every corner and both links of any other cell with two open sides, counting each wall as an edge.
- Before each step, check the cells around the line’s end. Go into any that’s down to two open sides, and step back if two are.
- Add up the distances between consecutive numbers. With no spare steps, take every stretch the short way, and with two, look for the single detour.
- After each step, make sure the empty cells still hang together and every pocket has two consecutive numbers beside it.
- For a pocket only one stretch can reach, count its cells. An odd count needs the stretch’s two numbers on the same colour, and an even count needs them on different colours.
- If two moves still survive, follow each a few steps until one fails, then undo it.
Pathfold’s sister puzzles are free on the App Store too. Crownfold has its own solving guide, and so does Evenfold, in how to solve binary puzzles.
-
Wikipedia, “Hamiltonian path”, https://en.wikipedia.org/wiki/Hamiltonian_path ↩
-
Alon Itai, Christos H. Papadimitriou and Jayme Luiz Szwarcfiter, “Hamilton Paths in Grid Graphs”, SIAM Journal on Computing 11(4), 676–686, November 1982, https://doi.org/10.1137/0211056 ↩
Frequently asked questions
How do you solve a number path puzzle?
Start where the line has the fewest choices. Corners and other cells with two open sides must use both, the line can never leave a cell with only one way in, and walls count as edges. Then count the steps between consecutive numbers, keep every pocket of empty cells beside two consecutive numbers, and check pockets with a chessboard colouring.
Where do you start a path puzzle?
In the corners. A corner has only two open sides, so the line must run through both, and so must any other cell that’s down to two open sides, such as a cell beside 1 once 1 has its link. Mark those links before you draw anything.
Do you have to fill every square in a number path puzzle?
Yes. The line has to pass through every cell exactly once, moving up, down, left or right, and finish on the highest number. In Pathfold the highest number can only be entered as the last cell, so a line can’t finish early.
How do you connect the numbers in order in a path puzzle?
Treat each pair of consecutive numbers as one stretch of the line. The numbers don’t say how many cells lie between them, but a stretch only passes through empty cells, so a group of empty cells can only be filled by a stretch whose two numbers both sit beside it.
What is the parity trick for path puzzles?
Colour the grid like a chessboard. Each step changes colour, so a stretch through an odd number of cells joins two numbers of the same colour, and one through an even number joins two of different colours. On a board with an odd number of cells, 1 and the highest number both sit on the corners’ colour.
Is Pathfold free?
Yes. Pathfold is free on the App Store for iPhone and iPad with iOS 17 or later, with no ads, no in-app purchases and no account. It has a new puzzle every day, six packs of 100 levels and an endless mode.
Building something like this?
9io is a small team of senior engineers with a fractional CTO. We work by the hour, and plans start at $5,000. Send us a note about your product. The reply comes from the person who'd do the work.