Hidato (also known as Hidoku) is a popular logic puzzle invented by Israeli mathematician Dr. Gyora Benedek. At first glance, it might remind you of Sudoku or a number maze, but its core dynamic relies on constructing a continuous path through a grid.
The challenge is to fill a $9 \times 9$ board with consecutive numbers from 1 to 81 such that each number is an immediate neighbor of the next—horizontally, vertically, or diagonally.
Given a board of dimensions $R \times C$ (in our case $9 \times 9$, with $N=F \cdot C=81$ cells) where some cells already contain fixed initial values, we must determine the placement of the remaining numbers while satisfying the following rules:
Number range: Each cell must contain a unique integer belonging to the set ${1, 2, \dots, N}$.
8-neighbor connectivity: Two consecutive numbers $k$ and $k+1$ must be placed in adjacent cells horizontally, vertically, or diagonally (Chebyshev distance equal to 1).
Initial clues: Pre-filled numbers on the starting board must strictly remain in their original positions.
Uniqueness: Each cell contains exactly one number, and each number appears on the board exactly once.
The key question we need to answer is: Is there a valid assignment of positions for the entire sequence from 1 to 81, and how can we find it automatically?
Consider the following example:
Do you dare to solve it logically before taking on the model?
Puzzle solution
By solving the binary linear optimization model with the given initial clues, the solver finds the unique continuous path connecting all numbers from 1 to 81 in a valid way:
The efficiency of this formulation lies in the consecutive adjacency constraints: by requiring that an active cell for $k$ forces the activation of $k+1$ within its 8-neighbor neighborhood, the solver quickly prunes search tree branches that would break the continuous path.
This logic game can be formulated elegantly and systematically as a Binary Linear Optimization problem. Care to give it a try?
To model Hidato as a binary linear optimization problem, we represent the placement of each number on the board using three-indexed binary variables: vertical position, horizontal position, and the assigned numerical value.
Want to keep exploring the world of Operations Research? Discover more posts on this topic here.
If you found this useful, please cite this as:
Martín-Campo, F. Javier (Jun 2026). The Hidato Number Maze. https://www.fjmartincampo.com/blog/2026/hidato/.
or as a BibTeX entry:
@misc{martín-campo2026the-hidato-number-maze,title={The Hidato Number Maze},author={Martín-Campo, F. Javier},year={2026},month={Jun},url={https://www.fjmartincampo.com/blog/2026/hidato/}}
Enjoy Reading This Article?
Here are some more articles you might like to read next: