Sudoku solveur/generator
This program was written as a student project, the comments in the .m and the commands of the interface are in french, sorry for that.
Here is a summary of the main functions :
- generate a full grid - it fills the 1st row with a randperm(9), then fills the 1st 3x3 square in the same way (of course the first row of this square is already filled), finally it fills the grid case by case with a random() on the list of the possibilities of each case (this is the big picture)
- pick off cases - the user chooses how many cases have to be empty, the prog picks off cases randomly but make sure that the sudoku as a unique solution and is symmetrical
- solve sudoku - it uses a lot of methods described on the internet but basically it makes a list of elect numbers in each case, then shorten this list and fill the cases where there is only 1 possibility. I use a simple backtracking algo to solve the sudoku when the previous techniques don't work (but most of the time the backtracking is used only on a very few number of undetermined cases).
It also can display the possibilities of each cases (the numbers which are in red or purple are sure and grey one only a possibility).
Please notice that in the interface you have to use the RIGHT button on your mouse to run a command, the left one is only used to get the help of the said function.
I hope a made myself clear, i can answer any further questions.
Cite As
Julien (2024). Sudoku solveur/generator (https://www.mathworks.com/matlabcentral/fileexchange/26655-sudoku-solveur-generator), MATLAB Central File Exchange. Retrieved .
MATLAB Release Compatibility
Platform Compatibility
Windows macOS LinuxTags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!Discover Live Editor
Create scripts with code, output, and formatted text in a single executable document.
Version | Published | Release Notes | |
---|---|---|---|
1.0.0.0 |