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   

C++ Sudoku Generator

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

Joined: 21 Jan 2010
Posts: 1
:

Items
PostPosted: Thu Jan 21, 2010 5:56 pm    Post subject: C++ Sudoku Generator Reply with quote

Hello Everyone
Making a sudoku generator+solver program on C++ was what I decided to make over the christmas holidays.But when I went onto the generating puzzles part of it , I got stuck. I could not find a way to make a error free Sudoku Generator.
I would be very grateful if i get some Help.
Expecting a favorable reply
With Regards
Back to top
View user's profile Send private message
JasonLion

Joined: 16 Nov 2008
Posts: 62
:
Location: Silver Spring, MD

Items
PostPosted: Thu Jan 21, 2010 7:14 pm    Post subject: Reply with quote

There are several different ways to write a Sudoku puzzle generator. The two most common approaches are:

1) Add a few digits at random and then check to see if the puzzle can still be solved (one or more solutions). If there is more than one solution, try again adding more digits until you have only a single solution. If there are not any solutions then remove the digits you just added and try again. If there is exactly one solution then stop.

2) Build a completely filled in valid Sudoku grid. This can be done using a solver that makes a random choice each time it needs to guess. Then remove clues, checking that there is still only on solution after each set of removals. If there are several solutions, replace the digits just removed and try removing something else. Continue until there are an appropriate number of clues remaining.

Both approaches depend on having a fast brute force solver. Both approaches also create puzzles of random difficulty levels. Additional work is required to determine the difficulty level of the puzzle and decide if it is appropriate.

You can constrain the maximum difficulty level of the puzzle by replacing the brute force solver with a human techniques solver that only uses the techniques you are interested in. Depending on your goals, and the desired difficulty rating, this may be slower than using a brute force solver and determining difficulty afterwards.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Sudoku Programmers Forum Index -> Setting 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