User:RichWareham/Nonograms
From GASP
This is a simple Nonogram solver written in C#. It came about due to a discussion in a pub with Simon Tatham as all the best programs are. It compiles under Mono and should compile and run under Microsoft's runtime but I haven't tested this. The program uses a simple iterative approach to solving the puzzles and supports a limited degree of ambiguity in the partial-solution by being able to investigate speculative solutions. This allows it to deal with the more difficult nonograms which foil more simplistic algorithms.
The program either solves a difficult 4x4 case when run or solves a set of puzzles passed at the command line. For example:
rjw57@vega Nonograms $ build/bin/Nonograms.exe Nonogram Solver Created nonogram '4x4:2/1/2/1/1.1/2/1/1' Solving... Did I get a solution?: Yes Solution: ##....## ####.... ....##.. ....##.. rjw57@vega Nonograms $ build/bin/Nonograms.exe 10x10:3/2.1/2.2/2.1/1.2.1/1.1/1.4.1/1.1.2/3.1/4/3/2.1/1.1/1.4/1.1.1.1/2.1.1.1/2.1.1/1.2/2.3/3 Nonogram Solver Created nonogram '10x10:3/2.1/2.2/2.1/1.2.1/1.1/1.4.1/1.1.2/3.1/4/3/2.1/1.1/1.4/1.1.1.1/2.1.1.1/2.1.1/1.2/2.3/3' Solving... Did I get a solution?: Yes Solution: ..........######.... ......####......##.. ......##........##.. ....##......######## ....##..##..##....## ####....##..##....## ####........##....## ##............####.. ..####....######.... ....######..........
The format of the game specification should hopefully be fairly obvious. This program was written just to get me familiar with the .NET runtime and way of doing things so it is a bit ugly, under-documented and may be somewhat slow. YMMV.
Downloads
License
Copyright (c) 2004 Rich Wareham
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
