# Constructing and Solving Nonograms

Initializing live version

Requires a Wolfram Notebook System

Interact on desktop, mobile and cloud with the free Wolfram Player or other Wolfram Language products.

Nonograms are logic puzzles in which cells in a grid must be colored or left blank according to numbers at the side and bottom of the grid to reveal a hidden pattern.

[more]

This Demonstration lets you construct a nonogram and then try to solve it. A grid of squares is given. For each square, you can either fill it in with gray or leave it as white. The numbers appearing to the right of the rows or under the columns give the lengths of the runs of gray squares in that row or column. For example, 1, 2 means there is one gray square followed by two; the number of white squares separating them, before the first one or after it, is not given.

The object of the puzzle is to find all the gray squares. Click a square to change its color. You may use yellow to indicate that a square is definitely not gray.

[less]

Contributed by: Izidor Hafner (February 2016)
Open content licensed under CC BY-NC-SA

## Details

It was shown in [2] that determining whether a nonogram has a solution and finding a solution is NP-complete, which means a difficult programming effort is required to solve either problem.

[1] Wikipedia. "Nonogram." (Jan 21, 2016) en.wikipedia.org/wiki/Nonogram.

[2] J. N. van Rijn, "Playing Games: The Complexity of Klondike, Mahjong, Nonograms and Animal Chess," M. S. thesis, Leiden Institute of Advanced Computer Science, Leiden, Netherlands, 2012. liacs.leidenuniv.nl/assets/2012-01JanvanRijn_2.pdf.

## Permanent Citation

Izidor Hafner

 Feedback (field required) Email (field required) Name Occupation Organization Note: Your message & contact information may be shared with the author of any specific Demonstration for which you give feedback. Send