I would like to write a solver for these kind of Arrow-Ring puzzles. However, I can't encode all the constraints correctly.
I noticed that Sudoku can be solved using integer programming and I am hoping it can be done for this kind of puzzle as well. Let's take a look at the rules:
- Draw a line to make a single loop. Lines pass through the centers of cells, horizontally, vertically, or turning.
- The loop never crosses itself, branches off, or goes through the same cell twice.
- The numbers show how many black cells there are in the direction of the arrow.
- The loop does not pass through the black cells or the cells with numbers, and black cells cannot touch horizontally or vertically.
The first constrant seem the most difficult, that we should require a single closed loop. And I wonder if integer programming is even the best way to solve these, but it's a start.
The third constraint (with numerical hints) is the most clear and for simplicity, they could also be replaced by black squares. However, if you already know how to encode these as integer programming problems, go for it.
Lastly, are there other algorithms that are efficient for finding loops in graphs with constrants? Wikipedia suggests this could be a Hamiltonian Path or an SAT problem.