View previous topic :: View next topic |
Author |
Message |
| Paul
| Joined: 11 Aug 2005 | Posts: 29 | : | | Items |
|
Posted: Tue Oct 25, 2005 11:39 am Post subject: A decent method for creating puzzles? |
|
|
Having finally made a start on generating puzzles, i'm not sure that the quality is that good. I would appreciate any ideas on how to improve this method:
For cells 1 to 81:
Pick a random number 1-9,
If does not invalidate the puzzle, add.
Else step back a number of cells (random between 2-8).
Repeat this process until full grid is generated.
Next pick a number from the range (1,41)
Pick it's symmetrical equivalent (i.e. 1,81 2,80 etc)
Remove both numbers from puzzle.
After a set number of pair removals (20-30) try solving.
Keep removing pairs (<41) and solving until unsolvable.
If unsolvable, add pair back to list and try again a maximum of 3 times.
Save last solvable puzzle.
This method either creates extremely easy or extremly hard puzzles. Medium ones are extremly rare. Can anyone enlighten why?? |
|
Back to top |
|
|
| Lardarse
| Joined: 06 Sep 2005 | Posts: 11 | : | Location: Bristol, UK | Items |
|
Posted: Wed Oct 26, 2005 7:41 am Post subject: Re: A decent method for creating puzzles? |
|
|
Paul wrote: | Having finally made a start on generating puzzles, i'm not sure that the quality is that good. I would appreciate any ideas on how to improve this method:
For cells 1 to 81:
Pick a random number 1-9,
If does not invalidate the puzzle, add. |
It would be better to pick from the possible numbers left.
Quote: | Else step back a number of cells (random between 2-8).
Repeat this process until full grid is generated. |
I would say to only remove random numbers after you have tried a few times and failed to put numbers in.
Quote: | Next pick a number from the range (1,41)
Pick it's symmetrical equivalent (i.e. 1,81 2,80 etc)
Remove both numbers from puzzle. |
If you would prefer to go down the route of not having to be symmetrical, then you would just remove one number at a time.
Quote: | After a set number of pair removals (20-30) try solving.
Keep removing pairs (<41) and solving until unsolvable.
If unsolvable, add pair back to list and try again a maximum of 3 times.
Save last solvable puzzle. |
Sounds good.
Quote: | This method either creates extremely easy or extremly hard puzzles. Medium ones are extremly rare. Can anyone enlighten why?? |
I will defer to the people that have written generators...
LA |
|
Back to top |
|
|
| Paul
| Joined: 11 Aug 2005 | Posts: 29 | : | | Items |
|
Posted: Wed Oct 26, 2005 8:47 am Post subject: |
|
|
Thanks Lardarse,
Quote: | It would be better to pick from the possible numbers left. |
Good idea, i should eliminate numbers before picking.
Quote: | I would say to only remove random numbers after you have tried a few times and failed to put numbers in. |
I now eliminate until a number is found or until i run out of numbers. Only then do i 'fail' and step back.
Will let you know how i get on this time... |
|
Back to top |
|
|
| Paul
| Joined: 11 Aug 2005 | Posts: 29 | : | | Items |
|
Posted: Tue Nov 01, 2005 10:34 pm Post subject: |
|
|
Just like to say that i used the advice, and am very happy now with the generator. Very slow, but hey, quality over quantity
Anyway, some examples off the production line:
Code: | .19......
.3....5.2
8...6..49
...3.24.1
.........
1.24.8...
28..5...6
9.4....7.
......35. |
Code: | ..4.....6
86.41....
...3.6...
15....6..
2...3...4
..8....25
...5.9...
....61.92
5.....7.. |
Code: | 9....5.7.
..69...18
..16.....
.5....9..
.3.7.8.4.
..4....2.
.....41..
84...63..
.6.2....4 |
|
|
Back to top |
|
|
|