# Hidato

Hidato Example

Hidato is a puzzle invented by Dr. Gyora Benedek.

Cell types

In an unsolved puzzles, some cells are black (gray), while others are white. Some white cells are numbered, with the lowest number (1) and the greatest number (number of white cells in the grid) are boldfaced. In a solved puzzle, all white cells have a number on each of them such that the numbers are all distinct, between the two boldfaced numbers inclusive.

Interaction

We have this man in a long journey. He must start from the cell numbered 1, and going to an orthogonally or diagonally adjacent cell one step at a time, visiting all cells exactly once, and finally arriving in the final, largest number to unlock the treasure.

Every number other than the largest one is orthogonally or diagonally adjacent to the number succeeding it. So, 1 is adjacent to 2, 2 is adjacent to 3, and so on. A cell may only contain one number, and a black cell doesn’t have any number.

Objective

Fill each white cell with a number to satisfy the above condition.

Walkthrough of the example

See R4C1. It is not either the largest or the smallest, so it must be connected with two numbers. Just enough are provided to its right and its top-right, so R4C1 is 13 and R3C2 is 12.

A similar approach at R1C4. R1C4 must be 3 or 5. But if R1C4 is 3, then R2C3 is 2 and R2C3 is not adjacent to 1, wrong. So R1C4 must be 5, and thus R2C3 is 6.

See R1C1. If it’s not 2, then it must be adjacent to both R1C2 and R2C2. However, 2 is also among these two cells, so R1C1 must be 3. However, if it’s 3, it’s not adjacent to the 4, so contradiction. So R1C1 is 2.

If R2C2 is 3, R1C2 is isolated. Then R2C2 is not 3 and thus R1C2 is 3. This makes R2C2 adjacent to either R2C3 and R3C3, or R3C2 and R3C3. It can’t be adjacent to R2C3 and R3C2, since the two numbers are not separated by 2.

If R2C2 is 11 (so it’s adjacent to R3C2), R3C3 is 10, trapping the 6. So R2C2 is not 11, and thus it’s adjacent to R2C3; R2C2 is 7, and R3C3 is 8. This connects easily, with R4C4 being 10 and R4C3 being 11.