Code covered by the BSD License  

Highlights from
Sudoku solveur/generator

Be the first to rate this file! 12 Downloads (last 30 days) File Size: 20.33 KB File ID: #26655
image thumbnail

Sudoku solveur/generator

by Julien

 

12 Feb 2010

Generate a full grid, pick off cases, display possibilities in each case, solve a sudoku

| Watch this File

File Information
Description

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.

MATLAB release MATLAB 7.5 (R2007b)
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Please login to add a comment or rating.
Tag Activity for this File
Tag Applied By Date/Time
sudoku Julien 12 Feb 2010 10:19:44
grid Julien 12 Feb 2010 10:19:44
case Julien 12 Feb 2010 10:19:44
grille Julien 12 Feb 2010 10:19:44
solve Julien 12 Feb 2010 10:19:44
résoud Julien 12 Feb 2010 10:19:44
résoudre Julien 12 Feb 2010 10:19:44
solution Julien 12 Feb 2010 10:19:44
game Julien 12 Feb 2010 10:19:44
games Julien 12 Feb 2010 10:19:44
jeu Julien 12 Feb 2010 10:19:44
jeux Julien 12 Feb 2010 10:19:44
generate Julien 12 Feb 2010 10:19:44
générer Julien 12 Feb 2010 10:19:44

Contact us at files@mathworks.com