Skip to main content

An efficient algorithm for solving nonograms

Abstract

Nonogram is one of logical games popular in Japan and Netherlands. Solving nonogram is a NP-complete problem. There are some related papers proposed. Some use genetic algorithm (GA), but the solution may get stuck in local optima. Some use depth first search (DFS) algorithm, the execution speed is very slow. In this paper, we propose a puzzle solving algorithm to treat these problems. Based on the fact that most of nonograms are compact and contiguous, some logical rules are deduced to paint some cells. Then, we use the chronological backtracking algorithm to solve those undetermined cells and logical rules to improve the search efficiently. Experimental results show that our algorithm can solve nonograms successfully, and the processing speed is significantly faster than that of DFS. Moreover, our method can determine that a nonogram has no solution.

This is a preview of subscription content, access via your institution.

References

  1. 1.

    Ueda N, Nagao T (1996) NP-completeness results for NONOGRAM via parsimonious reductions. Technical report TR96-0008, Department of Computer Science, Tokyo Institute of Technology, May 1996

  2. 2.

    McPhail BP (2005) Light up is NP-complete. Feb 2005. http://www.reed.edu/~mcphailb/lightup.pdf

  3. 3.

    Batenburg KJ (2003) An evolutionary algorithm for discrete tomography. Master thesis in computer science, University of Leiden, The Netherlands

  4. 4.

    Batenburg KJ, Kosters WA (2004) A discrete tomography approach to Japanese puzzles. Proceedings of BNAIC, pp 243–250

  5. 5.

    Tsang EPK (1993) Foundations of constraint satisfaction. Academic Press, London

    Google Scholar 

  6. 6.

    Wiggers WA (2004) A comparison of a genetic algorithm and a depth first search algorithm applied to Japanese nonograms. Twente student conference on IT, Jun 2004

  7. 7.

    http://www.pro.or.jp/~fuji/java/puzzle/nonogram/knowhow.html

  8. 8.

    Database of Japanese puzzles. http://hattori.m78.com/puzzle/picture/java/stage_01/index.html and http://www.books.com.tw/exep/prod/booksfile.php?item=0010317755

Download references

Author information

Affiliations

Authors

Corresponding author

Correspondence to Ling-Hwei Chen.

Rights and permissions

Reprints and Permissions

About this article

Cite this article

Yu, CH., Lee, HL. & Chen, LH. An efficient algorithm for solving nonograms. Appl Intell 35, 18–31 (2011). https://doi.org/10.1007/s10489-009-0200-0

Download citation

  • Japanese puzzle
  • Nonogram
  • Depth first search
  • Chronological backtracking