Skip to content

Latest commit

 

History

History
78 lines (76 loc) · 3.18 KB

README.MD

File metadata and controls

78 lines (76 loc) · 3.18 KB

Nonogram solver

Building

This is standard cmake project so this project can be build like other cmake based project. Here is the simplest way to build this project using make:

mkdir build
cmake ..
make

Or if you want to use ninja:

mkdir build
cmake -GNinja ..
ninja

Running example

Running one of the sample from build directory in linux:

./nonogram < ../sample/2.nonogram

output:

....[][][]..[]............[]..[][][]....
..[][][][][]..[]........[]..[][][][][]..
[][][][][][][]..[]....[]..[][][][][][][]
[][][]....[][][]..[][]..[][][]....[][][]
[][]..[][]..[][]..[][]..[][]..[][]..[][]
[]..[]....[]..[]..[][]..[]..[]....[]..[]
[]..[]....[]..[][][][][][]..[]....[]..[]
[][]..[][]..[][][][][][][][]..[][]..[][]
[][][]....[][][][][][][][][][]....[][][]
..[][][][][][][][][][][][][][][][][][]..
..[][][][][][][]..[][]..[][][][][][][]..
....[][][]......[][][][]......[][][]....
..........[][][][][][][][][][]..........
....[][][][][][][][][][][][][][][]......
....[][]....[][][][][][][][]....[][]....
..[][]..[][]..[][][][][][]..[][]..[]....
..[][]..[][]..[]..[][]..[]..[][]..[][]..
..[][][]....[][]..[][]..[][]....[][][]..
....[][][][][][]........[][][][][][]....
......[][][][]............[][][][]......

For reading clarity [] is solid cell and .. is empty cell.

Input structure

The input file is split into 2 part which is row cue and column cue separated by a line containing only semicolon (;).

                           3      column cue       3 
                         3 1 3                   3 1 3 
                         1 1 2 1               1 2 1 1 
                       4 1 3 3 3               3 3 3 1 4
                     4 2 3 1 2 4 1 1       1 1 4 2 1 3 2 4 
                     4 4 2 2 2 3 8 4       4 8 3 2 2 2 4 4 
                   7 3 6 3 2 2 3 7 5 15 15 5 7 3 2 2 3 6 3 7
                  +-------------------- --------------------
          3 1 1 3 |....[][][]..[]...... ......[]..[][][]....
          5 1 1 5 |..[][][][][]..[].... ....[]..[][][][][]..
          7 1 1 7 |[][][][][][][]..[].. ..[]..[][][][][][][]
        3 3 2 3 3 |[][][]....[][][]..[] []..[][][]....[][][]
    2 2 2 2 2 2 2 |[][]..[][]..[][]..[] []..[][]..[][]..[][]
1 1 1 1 2 1 1 1 1 |[]..[]....[]..[]..[] []..[]..[]....[]..[]
    1 1 1 6 1 1 1 |[]..[]....[]..[][][] [][][]..[]....[]..[]
        2 2 8 2 2 |[][]..[][]..[][][][] [][][][]..[][]..[][]
r          3 10 3 |[][][]....[][][][][] [][][][][]....[][][]
o              18 |..[][][][][][][][][] [][][][][][][][][]..
w           7 2 7 |..[][][][][][][]..[] []..[][][][][][][]..
            3 4 3 |....[][][]......[][] [][]......[][][]....
c              10 |..........[][][][][] [][][][][]..........
u              15 |....[][][][][][][][] [][][][][][][]......
e           2 8 2 |....[][]....[][][][] [][][][]....[][]....
        2 2 6 2 1 |..[][]..[][]..[][][] [][][]..[][]..[]....
    2 2 1 2 1 2 2 |..[][]..[][]..[]..[] []..[]..[][]..[][]..
        3 2 2 2 3 |..[][][]....[][]..[] []..[][]....[][][]..
              6 6 |....[][][][][][].... ....[][][][][][]....
              4 4 |......[][][][]...... ......[][][][]......

Take a look into sample/2.nonogram to see how puzzle above translated into input file for this program.