Hidato solver

Type the numbers of your hidato puzzle and the solver fills in the rest of the path from 1 to the end, draws it on the grid and checks that it is the only answer.

Type the given numbers into their cells. Switch to Block cells and tap the cells that are not part of the puzzle (shaded or missing in your grid). Arrow keys move between cells.

Solver

Examples (each has exactly one solution)

Paste or copy the grid as text

How to use the hidato solver

This hidato solver completes any hidato grid up to 12 by 12 (larger ones can be pasted as text). Choose the width and height, type the given numbers into their cells, and switch to Block cells to mark the cells that are not part of the puzzle, such as the shaded squares or the gaps around an irregular shape. Then press Solve. The missing numbers appear in gray, the path from 1 to the last number is drawn across the grid, and the solver tells you whether the answer is unique.

The rules

Hidato (also sold as Hidoku) fills every open cell with the numbers from 1 up to the number of open cells, each number once. Each number must touch the next one: horizontally, vertically or diagonally, like a king's move in chess. So the numbers trace one unbroken path through the whole grid. Usually the first and the last number are printed, along with enough numbers in between to make the path unique.

Is the answer unique?

After finding a path the solver keeps searching for a different one. You get one of these answers:

  • Exactly one solution: every other path was ruled out.
  • Two or more solutions: both are shown and the cells where they differ are highlighted, which usually means a given number was typed wrong or is missing.
  • No solution: no path fits. Before searching, the solver also checks for plain mistakes and names them: a number used twice, a number larger than the count of open cells, or two given numbers too far apart (the numbers 5 and 9 must be at most 4 king steps apart).

Every answer is checked before it is shown: each number from 1 to the end appears once, every pair of consecutive numbers touches, and every given number is where you typed it.

How the solver works

The solver fills the shortest gap between two known numbers first, because short gaps leave the fewest choices: if 12 and 15 are given, only a few pairs of cells can hold 13 and 14. It fills that gap one number at a time, and a step is refused if the far end of the gap could no longer be reached in time (from 12, the given 15 must be at most 3 king steps away). The open ends come last: the numbers before the first given one and after the last. After every step the whole grid is checked:

  • every empty cell needs at least two neighbors a path could still come from and go to, or one if it could be the first or the last number;
  • every empty cell must fit in some gap, by king distance to both of its ends;
  • no gap may be the only possible home for more cells than it has numbers.

Any failed check stops that branch at once. When the 1 or the last number is not given, the open ends are filled the same way. The examples on this page, up to 10 by 10, are solved and proved unique in about a thousand search steps or fewer, well under a tenth of a second.

Our test suite compares the solver with a plain brute force that tries every king path on small grids, and checks larger puzzles made from random paths through the grid, so every reported answer and every solution count is verified independently.

Tips for solving by hand

Look for consecutive gaps that are short: if 14 and 16 are given, 15 must be in a cell that touches both, and there are rarely more than two such cells. Long gaps are easier near walls and blocked cells, where the path has fewer ways to turn. Count the king distance between given numbers: when it equals their difference, the numbers in between must run in a straight or diagonal line.

Flow Free is another path puzzle: instead of one numbered path through every cell, it joins pairs of dots, and all the paths together must fill the grid.

To play, open hidato online: new number paths at three sizes and a daily grid.

Solver tested . Found a problem? Tell us.

Questions

Can numbers in hidato connect diagonally?

Yes. In hidato each number touches the next one in any of the eight directions, including diagonals. Puzzles that allow only horizontal and vertical steps are a different kind, often called Numbrix.

What if the 1 is not given?

The solver tries every cell that could hold the 1, so the puzzle still works as long as the other numbers pin the path down.

How do I enter a grid that is not a rectangle?

Use the smallest rectangle around it, switch to Block cells and tap every cell that is not part of the puzzle. Blocked cells are skipped by the path and do not count toward the last number.

Why does the solver say two numbers are too far apart?

Each step moves one cell in any direction, so two numbers that differ by d can be at most d king steps apart. If 3 and 5 are three cells apart, there is no room for the 4, and a number was probably typed in the wrong cell.

Is my puzzle sent anywhere?

No. The solver runs in your browser; nothing you type is uploaded.