Giter VIP home page Giter VIP logo

sudoku_solver's Introduction

Sudoku Solver

A sudoku puzzle solver appplication that applies transform-and-conquer strategies to solve the constraint satisfaction problem of standard and killer sudoku puzzles.

console example

Algorithms

Backtracking

An improvement on blind brute force generation of solutions. The backtracking algorithm tries to guess the value of each cell by trial and error, trying the next value if a guess breaks constraints on sudoku puzzles and backtracking if it has run out of possible values until the puzzle is solved or deemed unsolvable.

Algorithm X

Utilises a binary matrix representation of all possible cell values to represent the puzzle as an exact cover problem. This approach works in a similar way to the backtracking approach, using the binary matrix representation of the grid rather than the grid itself.

Dancing Links

Algorithm X is limited by the need to search a sparse binary matrix every time it seeks to access, remove or reinsert values. The Dancing Links approach instead represents the exact cover problem as doubly-linked linked 2D list (a very elegant implementation in my opinion).

Running the Program

$ javac *.java grid/*.java solver/*.java
$ java Sudoku [puzzle fileName] [game type] [solver type] [visualisation] <output fileName>
  • puzzle files are in /sampleGames
  • game type may be one of sudoku or killer
  • solver type
    • if game type is sudoku then choose be one of backtracking, algorx or dancing
    • if game type is killer then choose one of backtracking or advanced
  • visualisation: y or n

For ease of use, if you open this project in VSCode, I have included the launch.json file which allows running a range of preset configurations in the debugger.

sudoku_solver's People

Contributors

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