|
View previous topic :: View next topic |
Author |
Message |
| neilhirani
| Joined: 20 Dec 2005 | Posts: 1 | : | | Items |
|
Posted: Tue Dec 20, 2005 12:59 am Post subject: Generating Sudoku puzzles via Mathematica |
|
|
Does anyone have any programming experience with Mathematica?
If so, do you know how I would generate Sudoku puzzles using this language?
Initially, my algorithm goes to a random cell and adds a random number, from 1 to 9, in this cell.
After this is done, my algorithm goes to a random and empty cell and adds a legal number in this cell - this process should be repeated a certain number of times, but determining the number of times can be tricky.
When a puzzle is generated from this algorithm, I find that this puzzle gives a logical contradiction (i.e. two numbers have to go in the same cell).
Is there a better way to generate Sudoku puzzles?
Btw, Mathematica is primarily a functional programming language so any suggestions based on any functional programming language would be much appreciated.
Otherwise, any other suggestions would also be welcomed! |
|
Back to top |
|
|
| evert
| Joined: 30 Aug 2005 | Posts: 68 | : | Location: Amsterdam | Items |
|
Posted: Tue Dec 20, 2005 3:05 pm Post subject: |
|
|
Designing the algorithm is not really dependent of the programming language used, is it?
Quote: | Initially, my algorithm goes to a random cell and adds a random number, from 1 to 9, in this cell.
After this is done, my algorithm goes to a random and empty cell and adds a legal number in this cell - this process should be repeated a certain number of times, but determining the number of times can be tricky.
When a puzzle is generated from this algorithm, I find that this puzzle gives a logical contradiction (i.e. two numbers have to go in the same cell). |
Repeat this process until a contradiction has been found.
If a contradiction has been found empty your grid and start over again.
THIS process should be repeated until the gris is full without any contradiction. |
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
Igloo Theme Version 1.0 :: Created By: Andrew Charron
|