This project implements a Sudoku solver with both a command-line interface and a graphical user interface (GUI) using GTK+3. The solver can handle Sudoku puzzles of sizes 4x4, 9x9, 16x16, and 25x25.
If you are a beginner, don't worry. You have already been provided with a basic project structure. Your task now is to manage everything, and you are allowed to modify the structure as needed.
- Solves Sudoku puzzles of various sizes (4x4, 9x9, 16x16, 25x25)
- Command-line interface for quick solving
- Graphical user interface for interactive solving
- Displays the solved Sudoku grid
- Shows the total number of steps taken to solve the puzzle
- Classifies puzzle difficulty based on clues and solving steps
- GCC compiler
- GTK+3 development libraries
- Install MSYS2 from https://www.msys2.org/
- Open MSYS2 terminal and run:
pacman -S mingw-w64-x86_64-gtk3 mingw-w64-x86_64-gcc
- Go to repository directory
sudo apt-get update
sudo apt-get install libgtk-3-dev gcc
Go to repository directory
- Install Homebrew from https://brew.sh/
- Run:
brew install gtk+3
Go to repository directory
- Compile the program using the provided Makefile:
make clear make
- This will create an executable named sudoku_solver.
- To run the Sudoku solver with the graphical interface:
./sudoku_solver.exe
./sudoku_solver
- Compile the code using GCC:
gcc main.c ./src/core/sudoku.c -o sudoku_solver
- To run the Sudoku solver:
./sudoku_solver
- To run the Sudoku solver Using txt file:
./sudoku_solver ./EXAMPLE/puz.txt
The program initializes a pre-defined Sudoku puzzle and attempts to solve it. Modify the board array in main.c to test different puzzles.
Sudoku/
├── src/
│ ├── core/
│ │ ├── sudoku.c
│ │ └── sudoku.h
│ └── gui/
│ ├── main.c
│ ├── sudoku_gui.c
│ └── sudoku_gui.h
├── main.c
├── Makefile
└── README.md
- The program can solve Sudoku puzzles using a backtracking algorithm.
- In GUI mode, users can input puzzles interactively and solve them with a button click.
- In command-line mode, puzzles can be input manually or loaded from a file.
- The solver attempts to find empty cells and fill them with valid numbers.
- If a solution is found, it displays the completed board and solving statistics.
- The difficulty of the puzzle is classified based on the number of clues and solving steps.