Giter VIP home page Giter VIP logo

baptisteauduge / picross-solver Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 98 KB

Programme de résolution de puzzles de types "Picross" grâce à un algorithme de programmation dynamique, puis algorithme d'exploration partielle d'un arbre d'énumération (type algorithme de retour arrière avec "forward checking")

CMake 1.19% C++ 98.81%
cpp dynamic-programming enumeration-algorithm forward-checking picross-puzzle

picross-solver's Introduction

Picross Solver

This project is a solver for the game Picross (also known as Nonogram). The solver is implemented in C++ using dynamic programming and backtracking (forward checking) algorithms.

Implementation

The solver is implemented in the tomographie namespace, and the solver class is Tomographie. The Tomographie class has two main methods: color and enumeration. The color method uses dynamic programming to solve the puzzle, and the enumeration method uses backtracking to solve the puzzle.

The color method is the fastest method, and it is the default method used by the solver. The enumeration method is slower, but it is guaranteed to find a solution if one exists.

The enumeration method is also using the color method to solve the puzzle, but it is using backtracking to explore all possible solutions.

In other words, you can always use the enumeration method, that will find a solution in a really short time if propagation is enough, and if not, it will use an exhaustive search to find a solution.

Usage

The solver comes with a command line interface. You can use the solver by running the tomographie executable and passing the puzzle file as an argument.

The puzzle file is a text file with the following format:

3
1 1 1
3
1 1
1 1
#
1 1
1 2
3
1 2
1 1

Where the each line until the # is a row, and each line after the # is a column.

./tomographie <-p|-c> puzzle.txt

Where -p is the method to use (partial or complete (for -c)) and puzzle.txt is the puzzle file.

Example

You can run the following command to solve the puzzle in the file tests/input/0.txt:

./tomographie -p tests/input/0.txt

The output will be:

Opening file "../tests/input/0.txt" ...
File opened!
Time taken by program is : 0.000244708 sec 
Is grid successfully filled : 1
■■■□□
□□□□□
■□■□■
□□■■■

picross-solver's People

Contributors

baptisteauduge 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.