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   

[Newbie]Pseudo Code to create a full grid 9x9

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

Joined: 12 Aug 2005
Posts: 1
:

Items
PostPosted: Fri Aug 12, 2005 9:20 am    Post subject: [Newbie]Pseudo Code to create a full grid 9x9 Reply with quote

Hi,

I'm searching the pseudocode to create a full filled grid 9x9 of puzzle sudoku.

Can you help me ?

Thanks
Back to top
View user's profile Send private message
droid42

Joined: 29 Jul 2005
Posts: 20
:

Items
PostPosted: Fri Aug 12, 2005 9:45 am    Post subject: Reply with quote

I'm sure there are much better and faster ways but the following generates a full grid in less than 100ms depending on PC speed...

1. Start with an empty grid
2. Fill in 27 random values in random positions
3. Try to solve (simple logic usually suffices)
4. If the solver hits a dead-end or become inconsistent, go back to 1.

That's it.

A much quicker method is to start with a known full grid and then perform various transformations on it (e.g. swap rows/columns within the confines of a box, rotate the whole grid etc.) but this results in very "samey" groups of numbers and is probably of little value...

Ian.
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