Number Path techniques
The line has to fill every cell, so the grid edges and the line itself keep forcing moves. These four checks find them.
1. Corners
A corner cell has two neighbors. Unless the line starts or ends in that corner, it enters from one neighbor and leaves by the other, so both links are fixed before you draw anything. On a 5×5 grid that is up to eight links of the 24 in the finished line.
2. Cells with two open neighbors
The corner rule generalizes. As the line grows, any empty cell with only two open neighbors (cells not already passed through, or the current end of the line) must connect to both. A cell with one open neighbor has to be the finish; if it is not the highest number, the line so far is wrong.
Above, the line has run along the top row. The cell in row 2, column 3 now touches only the cells to its left and below it, so the line passes through it from one to the other.
3. Numbers act as walls until their turn
The line reaches the numbers in order, so while it travels from k to k + 1 every higher number is a wall. Combine this with the corner rule: if the only way past a corner runs through a higher number, that route is closed. In the example, stepping down from 1 leads straight into the corner 4, so the line cannot go that way.
4. The checkerboard rule
Shade the grid like a checkerboard. Every step changes color, so the line alternates shaded, white, shaded, and so on.
- On an odd grid (5×5, 7×7) there is one more cell of one color, and the line must start and end on that color.
- On an even grid (6×6, 8×8) the two colors are equal, and the line starts and ends on opposite colors.
- Any stretch of the line covers equal numbers of each color, or one extra of the color it starts and ends on. A pocket of cells that the line enters and leaves once must therefore be close to balanced. A pocket with two more shaded than white cells cannot be filled by one pass.