A Reasoning Framework for Solving Nonograms

  • K. Joost Batenburg
  • Walter A. Kosters
Part of the Lecture Notes in Computer Science book series (LNCS, volume 4958)


Nonograms, also known as Japanese puzzles, are logic puzzles that are sold by many news paper vendors. The challenge is to fill a grid with black and white pixels in such a way that a given description for each row and column, indicating the lengths of consecutive segments of black pixels, is adhered to. Although the Nonograms in puzzle books can usually be solved by hand, the general problem of solving Nonograms is NP-hard. In this paper, we propose a local reasoning framework that can be used to deduce the value of certain pixels in the puzzle, given a partial filling. By iterating this procedure, starting from an empty grid, it is often possible to solve the puzzle completely. Our approach is based on ideas from dynamic programming, 2-satisfiability problems, and network flows. Our experimental results demonstrate that the approach is capable of solving a variety of Nonograms that cannot be solved by simple logic reasoning within individual rows and columns, without resorting to branching operations. Moreover, all the computations involved in the solution process can be performed in polynomial time.


Polynomial Time Dependency Graph Black Pixel White Pixel Satisfying Assignment 
These keywords were added by machine and not by the authors. This process is experimental and the keywords may be updated as the learning algorithm improves.


Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.


  1. 1.
    Aharoni, R., Herman, G., Kuba, A.: Binary vectors partially determined by linear equation systems. Discrete Math. 171, 1–16 (1997)zbMATHCrossRefMathSciNetGoogle Scholar
  2. 2.
    Barcucci, E., Del Lungo, A., Nivat, M., Pinzani, R.: Reconstructing convex polyominoes from horizontal and vertical projections. Theoret. Comp. Sci. 155, 321–347 (1996)zbMATHCrossRefGoogle Scholar
  3. 3.
    Batenburg, K.J.: A network flow algorithm for reconstructing binary images from discrete X-rays. J. Math. Imaging Vision 27(2), 175–191 (2007)CrossRefMathSciNetGoogle Scholar
  4. 4.
    Batenburg, K.J., Kosters, W.A.: A discrete tomography approach to Japanese puzzles. In: Proceedings of the 16th Belgium-Netherlands Conference on Artificial Intelligence, BNAIC, pp. 243–250 (2004)Google Scholar
  5. 5.
    Garey, M., Johnson, D.: Computers and Intractability, A Guide to the Theory of NP-Completeness. W.H. Freeman, New York (1979)zbMATHGoogle Scholar
  6. 6.
    Kuba, A., Balogh, E.: Reconstruction of convex 2D discrete sets in polynomial time. Theoret. Comp. Sci. 283(1), 223–242 (2002)zbMATHCrossRefMathSciNetGoogle Scholar
  7. 7.
    Simpson, S.: Nonogram solver (2007),
  8. 8.
    Ueda, N., Nagao, T.: NP-completeness results for nonogram via parsimonious reductions (preprint, 1996),
  9. 9.
    Woeginger, G.: The reconstruction of polyominoes from their orthogonal projections. Inform. Process. Lett. 77, 225–229 (2001)zbMATHCrossRefMathSciNetGoogle Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 2008

Authors and Affiliations

  • K. Joost Batenburg
    • 1
  • Walter A. Kosters
    • 2
  1. 1.Vision Lab, Department of PhysicsUniversity of AntwerpBelgium
  2. 2.Leiden Institute of Advanced Computer ScienceLeiden UniversityThe Netherlands

Personalised recommendations