Sudoku Programmers Forum Index

 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister   ProfileProfile   Log inLog in          Games  Calendar

Log in to check your private messagesLog in to check your private messages   

Generating big puzzles

 
Post new topic   Reply to topic    Sudoku Programmers Forum Index -> Programming sudoku
View previous topic :: View next topic  
Author Message
mrmarky2

Joined: 13 Jan 2007
Posts: 64
:

Items
PostPosted: Wed Aug 20, 2008 9:19 am    Post subject: Generating big puzzles Reply with quote

I have a 3x3 generator that I made, I editted the code to work for any size puzzle. But my 5x5 generator is really slow, it generates the easiest puzzles in about a minute. The harder puzzles take even longer.
This is how I generate the puzzles:

1. Fill a grid with numbers
2. Take out a large number of the clues, and see if it solves with the techniques of that difficulty. If not, repeat this step until you have got rid of a large number of clues and the puzzle still solves.
3. Take out each number left individually, see if it can be solved without it, if it can, take it out, if not leave it in.
4. When all numbers have been tried theres your puzzle. (If I am looking for a hard puzzle and the puzzle generated isn't hard, It starts again)

How can I improve this to still get the same quality of puzzles? One person already on this forum has told me he generates his 5x5 in about 6 seconds each or something like that.

With it generating puzzles this slow, there no way i'm going to start on 6x6. Sad

Thanks for the help
Mark
Back to top
View user's profile Send private message
m_b_metcalf

Joined: 13 Mar 2006
Posts: 210
:
Location: Berlin

Items
PostPosted: Wed Aug 20, 2008 12:35 pm    Post subject: Re: Generating big puzzles Reply with quote

mrmarky2 wrote:
I have a 3x3 generator that I made, I editted the code to work for any size puzzle. But my 5x5 generator is really slow, it generates the easiest puzzles in about a minute. The harder puzzles take even longer.
This is how I generate the puzzles:

1. Fill a grid with numbers
2. Take out a large number of the clues, and see if it solves with the techniques of that difficulty. If not, repeat this step until you have got rid of a large number of clues and the puzzle still solves.
3. Take out each number left individually, see if it can be solved without it, if it can, take it out, if not leave it in.
4. When all numbers have been tried theres your puzzle. (If I am looking for a hard puzzle and the puzzle generated isn't hard, It starts again)

How can I improve this to still get the same quality of puzzles?


Firstly, take out a lesser number of clues in step 2., say about 120 disposed symmetrically. Secondly, take out other clues not individually, but in symmetric groups such that the final puzzle is symmetric.

HTH

Mike Metcalf
Back to top
View user's profile Send private message
mrmarky2

Joined: 13 Jan 2007
Posts: 64
:

Items
PostPosted: Wed Aug 20, 2008 12:52 pm    Post subject: Reply with quote

OK, I'll try that.
Thanks
Back to top
View user's profile Send private message
mrmarky2

Joined: 13 Jan 2007
Posts: 64
:

Items
PostPosted: Wed Aug 20, 2008 12:55 pm    Post subject: Reply with quote

The reason why I never put in symmettry before was that on the 3x3's, i thought it would take a long time to take them out in groups and find a hard puzzle. Does it take a lot longer to generate symmetrical puzzles?

Mark
Back to top
View user's profile Send private message
m_b_metcalf

Joined: 13 Mar 2006
Posts: 210
:
Location: Berlin

Items
PostPosted: Wed Aug 20, 2008 6:53 pm    Post subject: Reply with quote

mrmarky2 wrote:
The reason why I never put in symmettry before was that on the 3x3's, i thought it would take a long time to take them out in groups and find a hard puzzle. Does it take a lot longer to generate symmetrical puzzles?

Mark

It's faster because you make the deletion trials in blocks. However, it's more difficult to construct a hard puzzle. But walking before running is always good advice.

Regards,

Mike Metcalf

P.S. This thread properly belongs in 'Exotic sudoku'
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Sudoku Programmers Forum Index -> Programming sudoku All times are GMT
Page 1 of 1

 
Jump to:  
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
Sudoku Programmers topic RSS feed 


Powered by phpBB © 2001, 2005 phpBB Group

Igloo Theme Version 1.0 :: Created By: Andrew Charron