Skip to content

This is a Java implementation of a Sudoku puzzle solver. Given an unsolved Sudoku puzzle, the program finds the solution using a backtracking algorithm.

Notifications You must be signed in to change notification settings

hasnain-kk/Sudoku_Solver

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 

Repository files navigation

🧩 Sudoku Solver 🧩

This is a Java program that solves a given Sudoku puzzle using backtracking algorithm. It has a simple command-line interface and can solve any valid Sudoku puzzle within seconds.

🚀 Getting Started

  1. Clone the repository using the following command:
git clone https://github.com/hasnain-kk/sudoku_solver.git
  1. Open the project in your favorite Java IDE.
  2. Compile and run the SudokuSolver.java file.
  3. Enter the Sudoku puzzle row by row. Use 0 or any negative number to represent empty cells.
  4. Wait for the program to solve the puzzle.
  5. The solution will be displayed on the console.

📝 How It Works

The Sudoku Solver uses a backtracking algorithm to solve the puzzle. It tries different numbers for each empty cell until a solution is found. If the number is not valid for the current cell, it backtracks to the previous cell and tries a different number.

🔍 Algorithm Overview

The algorithm used in this program can be summarized in the following steps:

  1. Find the first empty cell in the grid.
  2. Try all numbers from 1 to 9 in the cell.
  3. If a number is valid for the cell, move to the next empty cell and repeat step 2.
  4. If all numbers have been tried and no number is valid for the cell, backtrack to the previous cell and try a different number.
  5. Repeat steps 2-4 until a solution is found or all possible combinations have been tried.

🤖 Technical Details

The Sudoku Solver is written in Java and uses a simple command-line interface. It uses a backtracking algorithm to solve the puzzle and can solve any valid Sudoku puzzle within seconds.

👨‍💻 Contribution Guidelines

If you find any bugs or issues with the program, feel free to open an issue or submit a pull request. Any contributions are welcome!

📜 License

This project is licensed under the MIT License - see the LICENSE file for details.

About

This is a Java implementation of a Sudoku puzzle solver. Given an unsolved Sudoku puzzle, the program finds the solution using a backtracking algorithm.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages