View previous topic :: View next topic |
Author |
Message |
| Xenos
| Joined: 03 Jan 2006 | Posts: 2 | : | | Items |
|
Posted: Tue Jan 03, 2006 6:26 pm Post subject: Sudoku Generator |
|
|
Hi everybody,
for a school project I am working on a sudoku generator. In my mind I had a step plan for writing this program:
- Program solver functionality ( Finished )
- Program a function that can create random sudoku solutions( you call them grids right?) ( Problem )
- Program a function that takes this random solution, removes random numbers and checks if the sudoku is still solveable. ( Not started yet )
I have tried to finish that second step, just by looping through a 81 number integer until it forms a sudoku solution, but this takes way to long.
Is there an easier way? I want a sudoku to appear within seconds, is this possible?
Please help me out,
David |
|
Back to top |
|
|
| Ikzann
| Joined: 03 Jan 2006 | Posts: 5 | : | | Items |
|
Posted: Sun Jan 08, 2006 4:02 pm Post subject: |
|
|
You probably want to use DLX. This can generate sudokus within 20-200 miliseconds, usually. You'll have to do some research, though. I don't know how to do it well enough to explain it to you. |
|
Back to top |
|
|
| Xenos
| Joined: 03 Jan 2006 | Posts: 2 | : | | Items |
|
Posted: Sun Jan 08, 2006 9:47 pm Post subject: |
|
|
Hi,
thanks for replying. However, I have already finished my sudoku generator now. I don't know what DLX means, but what my grid generator basically does is fill in numbers in the spaces with the least amount of possibilities untill the solver can solve it, and make a full grid out of it. If filling in a certain number makes the sudoku unsolvable, the program empties the grid, and the proces is restarted. This creates full grids pretty fast. I am sure that there are more efficient ways to do it, but this one works absoluty fine for my purposes!
Greetings,
David
P.S: I could have gotten the answer to my question by looking at other posts. I mean, everyone basically asks the same questions here |
|
Back to top |
|
|
| eclark
| Joined: 28 Dec 2005 | Posts: 70 | : | | Items |
|
Posted: Mon Jan 09, 2006 2:20 am Post subject: |
|
|
You may want to just try removing that last placed number rather than a full restart. That yeilds faster results |
|
Back to top |
|
|
| shirley
| Joined: 21 Jul 2006 | Posts: 1 | : | | Items |
|
Posted: Fri Jul 21, 2006 4:36 pm Post subject: |
|
|
eclark wrote: | You may want to just try removing that last placed number rather than a full restart. That yeilds faster results |
Hi,
I am just a junior student. I am interested in Sudoku, I would like to know how you can build up the Sudoku solver and then use it to build up the whole Sudoku program?
Would you like to share the ideas with me? |
|
Back to top |
|
|
| Papy
| Joined: 14 Jul 2006 | Posts: 12 | : | | Items |
|
Posted: Tue Aug 15, 2006 11:43 am Post subject: Generator |
|
|
Shirley
If you used specific Brute force you can have an 'reversible' alogo used to generate and solve grids
All the grids are equal each one can accept 17,20,25... reveled. Is't a caracteristique of the Latin Square
So if you generate a latin square , then remove numbers and run again the generator you can find the original square
If you genrate
123
456
789
you remove numbers to get
..3
4..
..9
if you run the generator you found
the solution BUT NOT ONLY
for example
213
465
879
The challenge is to determine the numbers to remove(how many and which)
Sorry for my poor English: I'm french.
I'm looking for the technique to detremine if a grid has only one solution?
Is some one can help me?
I'm laso looking after Grid Collection (NOT IN PDF)
Thanks
Jérôme |
|
Back to top |
|
|
|