Nonolog

Solve Nonogram Puzzles with Prolog

By Gus Polly at English Wikipedia - Own work, CC0, Link

Nonolog is a solver for nonogram (better known in English as picross) puzzles, and was an excuse for me to learn Prolog. The implementation itself is not worthy of report and very naively written, but may be interesting to those with a background in or curiosity for logic programming.

Nonogram puzzles present a grid with constraints on each row and column. Constraints reveal the number and length of contained cells, and when all constraints are met a picture is revealed. This screams for a computerized solution: the fabric of the puzzles themselves is binary.

Prolog was a natural language for expressing puzzle constraints. Compared to the additive thinking I'm comfortable with from most programming languages, where small pieces build up to a larger idea, writing Prolog felt to me distinctly subtractive, more like chiseling away all possibilities to define a boundary around an idea.

These puzzles have haunted my boredom, and in total have demanded many hours of my idle attention. My compulsion was particularly clear to me when I began noticing repeats in apps described as containing "infinite" puzzles. Instead of continuing to solve individual puzzles, I wondered if by solving all puzzles I would be cured. This has so far been true.

#