I have a matrix that consists of 0, 1, 2.
- 0 - dot.
- 1 - block.
- 2 - start dot (initial position in the path).
I have to create a path from the start dot, that
- connects all the dots in the matrix and
- visits each dot ONE time
- doesn't visit blocks
In other words, create a Hamiltonian path in a matrix. A pic below exhaustively shows what I want.