pebblewit

Guides

Number path puzzle tips: corners, parity and dead ends

A number path puzzle asks for one continuous line. In Pebble Path, the line starts on 1, visits the numbers in order, ends on the last number and passes through every cell exactly once, moving only between cells that share a side. In the game each cell is a stone. Some neighbouring cells are also separated by walls the line can't cross. The numbers set the order, but the empty cells decide the route, so most of the solving happens where cells have the fewest ways in and out.

Mathematicians call a route that visits every cell of a grid exactly once a Hamiltonian path, after William Rowan Hamilton, who invented a puzzle called the icosian game about routes like these. Our guide to Hamiltonian paths goes further into the idea.

Think in links

Picture the finished line as links between neighbouring cells. Every cell the line passes through has exactly two links, one in and one out. Only 1 and the last number have a single link each. So whenever any other cell has exactly two neighbours it can still link to, both links are forced, and you can draw them straight away.

Corners are always turned

A corner cell has only two neighbours. Unless it holds 1 or the last number, the line must come in through one and leave through the other. That means the two edge cells beside every empty corner are joined through it, and you can draw that little elbow before anything else. A middle number in a corner is forced the same way. If the corner holds 1 or the last number, the line uses just one of its two neighbours.

Edges, walls and dead ends

Edge cells have three neighbours, so they become forced as soon as one of those neighbours is used up. A wall acts like the edge of the board. A cell with walls on two sides behaves like a corner, and a cell closed in on three sides can only be an end of the line.

Keep an eye on the cells beside your line as you draw. An empty cell with only one usable neighbour left can only be filled if it is where the line ends. If it isn't, you have made a dead end, and the last stretch of line has to change.

Never split the empty cells

The cells you haven't visited yet must stay in one connected piece. If your line cuts them into two parts, it can finish one part but never get back to the other. Before each move, look for the gap you are about to close.

Bottlenecks are the extreme case. A pocket of cells that joins the rest of the board through a single cell can be entered but never left, because leaving would mean passing through that cell a second time. So such a pocket must hold the end of the line, or its start. A pocket with exactly two openings must be entered through one and left through the other.

Count colors like a chessboard

Shade the board like a chessboard. Every step of the line moves to a cell of the other shade, so the line alternates all the way along. Two useful counts follow from that.

Between two numbers on the same shade, the line visits an odd number of cells. Between numbers on different shades, it visits an even number, and zero counts, so two numbers side by side can be joined directly. Use this to test a plan. If you mean to sweep a five-cell pocket on the way from 3 to 4, and 3 and 4 sit on different shades, the plan fails as it stands: five is odd, so that stretch needs one cell more or one fewer.

The same counting works for whole areas. Any stretch of line that sweeps an area in one visit covers light and shaded cells that differ by at most one. On a board with an even number of cells, such as 4 by 4 or 6 by 6, the line starts and ends on different shades. On 5 by 5, 7 by 7 or 9 by 9, it starts and ends on the shade of the corners, which has one cell more.

Follow the numbers, but look ahead

It is tempting to race from 1 to 2 by the shortest route. Resist it. The line must cover every cell, so the real question at each number is which nearby cells have to be swept now, because the line may never come back for them. A corner pocket beside 2 that you skip on the way to 3 is usually lost for good.

Plan the ending early, too. The last number has a single link, so the line arrives there from one neighbour and stops. The cells around it tend to be the last area you fill, which tells you roughly where the line will travel near the end.

A worked 4 by 4 board

The puzzle123The solution123
A 4 by 4 board with three numbers, shaded like a chessboard. The solution on the right uses all sixteen cells.

Rows are counted from the top and columns from the left. Number 1 is in row 4, column 2, number 2 is just above it, and number 3 is at the top of the same column.

  1. Turn the corners. The bottom left corner joins 1 to the cell above the corner, and since 1 has only one link, the line starts by going from 1 into the corner and up. The top left corner joins 3 to the cell below it, so the line ends by climbing the left side, turning through that corner and stepping into 3. The other corners give elbows too: top right links row 1 column 3 with row 2 column 4, and bottom right links row 4 column 3 with row 3 column 4.
  2. Don't finish early. From row 3, column 1 the line can go up or right to 2. Going up would run through the top left corner into 3 after six cells and skip 2, so the line goes right to 2.
  3. Use the forced link. Row 2, column 1 still needs a second link, and its only remaining option is row 2, column 2.
  4. Keep the board whole. From 2 the line can go up to row 2, column 2 or right to row 3, column 3. Up would reach 3 after eight cells with eight still empty, so it goes right.
  5. Squeeze the edge. Row 4, column 3 has three neighbours, but one of them is 1, which already has its only link. So it must link to row 3, column 3 and to the bottom right corner: the line runs down from row 3 column 3, right into the corner and up to row 3 column 4.
  6. Follow what is forced. The rest has one way to go: up the right side into the top right corner, back to row 1 column 3, down to row 2 column 3, then left along row 2 and up through the top left corner to 3.

Now check the colors. With 16 cells, 1 and 3 should sit on different shades, and they do. Numbers 2 and 3 share a shade, and the line visits 11 cells between them, an odd number, exactly as the chessboard rule says.

Drawing, undoing and hints

Press 1 and drag to draw the line. To take part of it back, drag back along it, or press any stone on the line and carry on from there. Undo reverses your last move, so testing a route costs nothing. When you are stuck, a hint lights up the next three stones of the answer. If your line has already gone off course, the hint also rings the last stone that was right, so you know how far to go back. Each puzzle has three free hints.

LevelsBoard
1 to 54 by 4
6 to 155 by 5
16 to 1006 by 6
101 to 2207 by 7, with walls from level 121
221 to 3408 by 8
341 to 4008 by 8 and 9 by 9

Each board is labelled Gentle, Easy, Medium, Hard or Expert. The daily puzzle is a 7 by 7 board, the same for everyone: easy on Monday and Tuesday, medium from Wednesday to Friday and hard at the weekend, and about a third of dailies have walls. Every puzzle has exactly one solution, so if two routes both seem to work, one of them breaks further on. For habits that help with every kind of logic puzzle, see how to get better at logic puzzles.

Sources and further reading