Skip to content

The Sudoku Solver and Generator is an interactive Python-Tkinter app that lets users create, solve, and generate Sudoku puzzles of sizes 4x4, 9x9, and 16x16. It features dynamic grid creation, a powerful backtracking algorithm for solving, puzzle validation, and color-coded feedback. Ideal for learning, playing, and exploring Sudoku challenges!

Notifications You must be signed in to change notification settings

bipasamaji/Sudoku-Slover

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 

Repository files navigation

Sudoku Solver and Generator

An interactive desktop application for creating, solving, and generating Sudoku puzzles using Python and Tkinter. This project offers a user-friendly graphical interface and a robust backtracking algorithm to solve puzzles of varying dimensions, making it ideal for Sudoku enthusiasts and learners.

Features

🔢 Dynamic Grid Creation

Supports Sudoku grids of sizes 4x4, 9x9, and 16x16. Automatically adjusts the grid layout to match the selected size.

🧩 Sudoku Puzzle Solver

Solves Sudoku puzzles using an efficient backtracking algorithm. Detects and alerts users if a solution is not possible. Distinguishes solver-filled cells with a color-coded highlight.

🎲 Puzzle Generator

Generates Sudoku puzzles with random placements and unique solutions. Leaves some cells blank for the user to solve.

✅ Validation and Feedback

Ensures the grid size is valid (only perfect square dimensions allowed). Validates user inputs to ensure numbers fall within the valid range. Provides error messages for invalid grids or unsolvable puzzles.

🔄 Grid Management Allows users to reset the grid at any time. Clears user inputs and solver-generated values for a fresh start.

Installation

Prerequisites

Python 3.8 or higher. Tkinter library (comes pre-installed with Python on most platforms).

Steps

Clone the repository:

git clone https://github.com/yourusername/sudoku-solver-generator.git cd sudoku-solver-generator

Run the program:

python sudoku_solver.py

Usage

  1. Launch the Application: Run the script to open the Sudoku Solver and Generator GUI.
  2. Set Grid Dimensions: Enter a grid size (4, 9, or 16) in the input box.
  3. Create a Grid: Click the "Create Grid" button to generate an empty Sudoku grid.
  4. Generate a Puzzle: Click "Generate Sudoku" to create a new puzzle with pre-filled values.
  5. Solve a Puzzle: Enter numbers into the grid, then click "Solve Puzzle" to see the solution.
  6. Clear the Grid: Click "Clear Grid" to reset the board.

Project Structure

sudoku-solver-generator/ │ ├── sudoku_solver.py # Main application script ├── README.md # Project documentation

Technologies Used

Python: For core logic and algorithm implementation. Tkinter: For creating the graphical user interface. Random Module: For generating randomized puzzles.

How It Works

  1. Backtracking Algorithm The core of the solver is a backtracking algorithm that systematically tries numbers in empty cells, backtracking when conflicts arise, until a solution is found or deemed impossible.

  2. Puzzle Generator A complete puzzle is generated and then randomized numbers are removed while ensuring the puzzle retains a unique solution.

Screenshots

Coming soon...

Future Enhancements

Add difficulty levels (Easy, Medium, Hard) by varying the number of pre-filled cells. Implement hints to guide users during solving. Enhance the UI with grid-line separation for better sub-grid visibility. Add save/load functionality for puzzles.

Contributing

Contributions are welcome! Feel free to open an issue or submit a pull request.

  1. Fork the repository.
  2. Create a new branch: git checkout -b feature-name.
  3. Make your changes and commit: git commit -m "Add feature".
  4. Push to the branch: git push origin feature-name.
  5. Open a pull request.

Acknowledgments

Inspired by the classic Sudoku puzzle. Thanks to the Python and open-source communities for their amazing tools and resources! Enjoy solving Sudoku puzzles! 🎉

About

The Sudoku Solver and Generator is an interactive Python-Tkinter app that lets users create, solve, and generate Sudoku puzzles of sizes 4x4, 9x9, and 16x16. It features dynamic grid creation, a powerful backtracking algorithm for solving, puzzle validation, and color-coded feedback. Ideal for learning, playing, and exploring Sudoku challenges!

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages