top | item 46855689

(no title)

ahaferburg | 28 days ago

A couple years ago I wanted to design a custom Nonogram as a birthday present. We had a photo of the giftee and pixelated it. But how do you make sure the Nonogram is uniquely solvable, without any guessing? Of course I wrote a solver in Python.

But now I needed to test the solver. I had a couple of magazines with Nonograms. Transfer those manually into the computer? No way! So I wrote a utility that uses OpenCV to parse these low resolution pixel grids from photos, from the solutions page of the magazine. This was way harder than I imagined. A huge waste of time, but quite a fun project on its own.

For the solver I added one technique after the other. In the beginning it would not be able to solve all puzzles. Then it gradually became more capable, until it would no longer get stuck on the test inputs. A list of techniques like this would have been very helpful!

The solver was still quite slow, but it was really fun to watch it fill in the solution pixel by pixel. It took about 10-20 s to solve the larger puzzles.

discuss

order

No comments yet.