https://github.com/sofiasawczenko/sudoku
Sudoku Solver is a Java-based program that solves a given 9x9 Sudoku puzzle using a backtracking algorithm. The program attempts to fill empty cells by ensuring each number from 1 to 9 follows Sudoku's rules.
https://github.com/sofiasawczenko/sudoku
backtracking-algorithm sudoku
Last synced: about 1 year ago
JSON representation
Sudoku Solver is a Java-based program that solves a given 9x9 Sudoku puzzle using a backtracking algorithm. The program attempts to fill empty cells by ensuring each number from 1 to 9 follows Sudoku's rules.
- Host: GitHub
- URL: https://github.com/sofiasawczenko/sudoku
- Owner: sofiasawczenko
- Created: 2024-10-12T15:29:39.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-03-20T20:22:21.000Z (about 1 year ago)
- Last Synced: 2025-03-20T21:49:29.497Z (about 1 year ago)
- Topics: backtracking-algorithm, sudoku
- Language: Java
- Homepage:
- Size: 9.77 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Sudoku Solver in Java
A simple **Sudoku Solver** implemented in Java using a **backtracking algorithm**. The program fills in missing numbers in a 9x9 Sudoku grid while ensuring the solution follows Sudoku rules.
## How It Works
1. The program initializes a 9x9 Sudoku board with some prefilled numbers.
2. It applies a **recursive backtracking algorithm** to find a valid solution.
3. If a solution exists, the solved board is printed; otherwise, a message indicates that the board is unsolvable.
## Features
- Uses **backtracking** to find a valid solution.
- Prints the Sudoku board **before and after** solving.
- Ensures:
- Each row contains unique numbers (1-9).
- Each column contains unique numbers (1-9).
- Each 3x3 subgrid contains unique numbers (1-9).
## Installation & Usage
1. **Clone this repository**
```bash
git clone https://github.com/sofiasawczenko/sudoku.git
cd sudoku-solver
2. **Compile and Run**
```bash
javac SudokuSolver.java
java SudokuSolver