Skip to content

uguryavuz/numberlink-solver

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

numberlink-solver made-with-python python-3.7

Ugur Yavuz, August 2019

numberlink-solver is, as its name suggests, a Numberlink puzzle solver. This is achieved by converting the puzzle into a Boolean satisfiability (SAT) problem, and then using Google's OR-Tools library to solve this problem. The pygame library provides a visual interface for the creation of the puzzle.

How to run?

  • Clone or download this repository.
  • In the repository's directory, run setup.py in Terminal to install the necessary libraries.
  • Run solve_numberlink.py in Terminal. Input the puzzle's width, height and how many numbers there are.
  • In the graphic interface that shows up, select the numbers' locations in order.
  • Click 'Solve'. If no solution is found, the puzzle will be colored in the red tint. If a solution is found, it will be displayed.
  • If a solution is found, you can click 'Save as .JPG' to save a screenshot of the solution in the directory where solve_numberlink.py is situated.
  • Close the window, or press any combination out of ESC, Command + Q, ALT + F4, to terminate the program.

Notes

  • The solver assumes that the puzzles have a unique solution, following the convention for traditional Numberlink puzzles.

Future

  • Create and load from .CNF files.
  • Add my --educational solver (I had initially written a SAT solver myself, which turned out to be much slower than the one provided by OR-Tools).
  • Using a better suited graphics library than pygame.
  • Remove the unique solution assumption. Although the solver can currently solve such puzzles, it may end up creating free-standing loops. A constraint that doesn't allow solutions to contain free-standing loops must be added.

About

A Numberlink solver powered by Google's OR-Tools.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages