Giter VIP home page Giter VIP logo

sudoku-solver's Introduction

Sudoku-Solver

Java Code that reads any NxN Sudoku-puzzle from a file and finds solution to it. Uses Recursive Backtracking algorithm and therefore a solution is always gauranteed, except in case of sudokus with no solution. Also displays how much time it takes to find solution to a particular puzzle.

Usage Instructions:

  1. Download the Sudoku.jar along with the puzzle.txt file
  2. Make sure these files are in the same directory ย 3) Load your puzzle in the puzzle.txt file. Make sure you follow the format posted below. An example puzzle has been loaded. 0 stands for empty cells which the code tries to find solution to.
  3. From your terminal navigate to the directory where you saved the file
  4. Type in java -jar Sudoku.jar
  5. An alternative to Step 4 and 5 is typing java -jar space Drag and Drop the jar file. This only works for Linux and MacOS.

NOTE

You need to specify the number of number of rows and columns of the smaller box. This is implemented for solving higher NxN puzzles where rows are not equal to the columns. Example, for a 12x12 Sudoku Puzzle, each smaller box is 3x4. This also ensures a nice sudoku layout when printed.

File Format

3 0 0 4 0 2 0 9 0
0 0 0 0 0 9 0 6 3
0 0 7 0 6 3 1 0 0
0 9 1 7 2 6 0 8 0
0 0 0 9 0 1 0 0 0
0 2 0 3 8 5 9 1 0
0 0 8 1 9 0 2 0 0
6 7 0 2 0 0 0 0 0
0 3 0 6 0 4 0 0 9

sudoku-solver's People

Stargazers

 avatar  avatar

Forkers

valilus

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.