Git Product home page Git Product logo

nonogram-solver's Introduction

Nonogram Solver

Nonograms are puzzles that follow a set of simple rules and require intermediate pattern recognition skills to solve. This solver eschews those typical patterns by explicitly checking all feasible solutions and reducing the domain of solutions until the correct one is found. The solver has minimal complexity, i.e., no lookahead. It only employs a basic search heuristic based on the confidence of the value of a particular cell (calculated using the entropy).

The code right now is a mess but works well enough. I find that puzzles up to around 40x40 with a "dense" solution (half or more of the cells are black) take less than a minute to solve on my old laptop.

I was hoping to employ probabilistic programming in the future to augment this solver considerably, but that depends on my level of patience with working with Julia.

Input format

The input file's format is as follows:

R C

r1

r2

r3

...

c1

c2

c3

...

where R and C are the numbers of rows and columns respectively, and r#/c# are the specifications of "cell runs" for each row and column (read left-to-right and top-to-bottom). I have included a test file with moderate difficulty, shark.txt.

Running the code

To run the Julia code, I usually just JIT compile by typing julia nonogram.jl shark.txt into the terminal. The result will print after every update and so takes longer than it probably could.

nonogram-solver's People

Contributors

lukasmericle avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.