|
Prev: HOW TO - dll in dev-c++
Next: Best book
From: The Prog on 25 May 2006 03:55 i need help to design a sudoku generation program without using OOP and it has to generate valid sudoku puzzles and an attached solution. can some someone help me with the algorithm for check a no. with it's respective (3x3) box too. help is much appreciated thanks :-))))
From: Jim Langston on 25 May 2006 05:48 "The Prog" <karankp2003(a)gmail.com> wrote in message news:1148543735.521055.242930(a)g10g2000cwb.googlegroups.com... >i need help to design a sudoku generation program without using OOP and > it has to generate valid sudoku puzzles and an attached solution. > > can some someone help me with the algorithm for check a no. with it's > respective (3x3) box too. > > help is much appreciated > thanks > :-)))) Sorry, we will not do your homework for you.
From: Richard Heathfield on 25 May 2006 05:56 [comp.programming added, followups set] The Prog said: > i need help to design a sudoku generation program without using OOP and > it has to generate valid sudoku puzzles and an attached solution. > > can some someone help me with the algorithm for check a no. with it's > respective (3x3) box too. In Sudoku, numbers don't have "respective boxes". Each number must appear exactly once in each row, each column, and each major 3x3 box. This is more of an algorithm question than a C question, so I suggest you try asking it in a more generalised newsgroup such as comp.programming. I haven't written a Sudoku generator myself, yet, but it seems to me that one obvious way to start would be to write a Sudoku solver, make sure it works, and then use it in the generator, as follows: (1) start with a full, valid, randomly generated grid (count = 81) (2) while you think you have too many clues (count is too high): (3) remove a number (4) submit the problem to the solver (5) if the puzzle cannot be solved: (6) replace the number you removed (7) else (8) decrement count (9) end if (10) end while A full, valid, randomly generated grid is easy enough, and you don't need anything sophisticated if you don't care too much about efficiency. -- Richard Heathfield "Usenet is a strange place" - dmr 29/7/1999 http://www.cpax.org.uk email: rjh at above domain (but drop the www, obviously)
From: n.luke.meyers@gmail.com on 26 May 2006 03:48 The Prog wrote: > i need help to design a sudoku generation program without using OOP and > it has to generate valid sudoku puzzles and an attached solution. That sounds like a very enjoyable problem to work on. Aren't you lucky! > can some someone help me with the algorithm for check a no. with it's > respective (3x3) box too. Absolutely! Please post your best attempt, and you'll get all kinds of useful feedback. > help is much appreciated Too rarely is it so. Luke
|
Pages: 1 Prev: HOW TO - dll in dev-c++ Next: Best book |