Table of Contents
Fetching ...

Solving nonograms using Neural Networks

José María Buades Rubio, Antoni Jaume-i-Capó, David López González, Gabriel Moyà Alcover

TL;DR

This work tackles solving nonograms by integrating neural networks with traditional solvers, addressing the gap where networks have not previously been used for nonogram resolution. It introduces multiple NN-assisted solver variants (NeHI, NeHPF, NeHPFI, Ne8 variants) and a GA, all built around a fully connected network that predicts board states from header information, aided by eight symmetry reflections. A large public dataset (NonoDataset) and code are published to enable training and evaluation across 5×5, 10×10, and 15×15 boards; results show that while the NN alone cannot solve all puzzles, it provides valuable starting guidance, and the best performing approach (Ne8HPFI) combines NN predictions with partial/complete erase and intuition to outperform other methods. Genetic algorithms underperform in this setting, highlighting the value of NN-guided heuristics for nonogram solving, and the work offers practical impact by enabling faster, scalable puzzle solving and by providing resources for further research.

Abstract

Nonograms are logic puzzles in which cells in a grid must be colored or left blank according to the numbers that are located in its headers. In this study, we analyze different techniques to solve this type of logical problem using an Heuristic Algorithm, Genetic Algorithm, and Heuristic Algorithm with Neural Network. Furthermore, we generate a public dataset to train the neural networks. We published this dataset and the code of the algorithms. Combination of the heuristic algorithm with a neural network obtained the best results. From state of the art review, no previous works used neural network to solve nonograms, nor combined a network with other algorithms to accelerate the resolution process.

Solving nonograms using Neural Networks

TL;DR

This work tackles solving nonograms by integrating neural networks with traditional solvers, addressing the gap where networks have not previously been used for nonogram resolution. It introduces multiple NN-assisted solver variants (NeHI, NeHPF, NeHPFI, Ne8 variants) and a GA, all built around a fully connected network that predicts board states from header information, aided by eight symmetry reflections. A large public dataset (NonoDataset) and code are published to enable training and evaluation across 5×5, 10×10, and 15×15 boards; results show that while the NN alone cannot solve all puzzles, it provides valuable starting guidance, and the best performing approach (Ne8HPFI) combines NN predictions with partial/complete erase and intuition to outperform other methods. Genetic algorithms underperform in this setting, highlighting the value of NN-guided heuristics for nonogram solving, and the work offers practical impact by enabling faster, scalable puzzle solving and by providing resources for further research.

Abstract

Nonograms are logic puzzles in which cells in a grid must be colored or left blank according to the numbers that are located in its headers. In this study, we analyze different techniques to solve this type of logical problem using an Heuristic Algorithm, Genetic Algorithm, and Heuristic Algorithm with Neural Network. Furthermore, we generate a public dataset to train the neural networks. We published this dataset and the code of the algorithms. Combination of the heuristic algorithm with a neural network obtained the best results. From state of the art review, no previous works used neural network to solve nonograms, nor combined a network with other algorithms to accelerate the resolution process.
Paper Structure (33 sections, 3 equations, 10 figures, 8 tables, 5 algorithms)

This paper contains 33 sections, 3 equations, 10 figures, 8 tables, 5 algorithms.

Figures (10)

  • Figure 1: Examples of different nonogram states: unsolved, partially solved, and solved. The black cells are considered as filled, whereas those with a cross are empty.
  • Figure 2: Nonogram with multiple solutions.
  • Figure 3: Example of all existing configurations in a five-column nonogram. The numbers represent the row encondings.
  • Figure 4: Given the nonogram on the left, we codify its headers and construct a one-dimensional vector. This vector is the network input. As a result, we obtain a vector of size $width\cdot height$ that we can easily transform into a nonogram board.
  • Figure 5: Visual description of the reflections on a $5\times5$ board.
  • ...and 5 more figures