From: Matthew Moss Date: 2008-11-08T00:01:55+09:00 Subject: [QUIZ] Sudoku Generator (#182) -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- The three rules of Ruby Quiz 2: 1. Please do not post any solutions or spoiler discussion for this quiz until 48 hours have passed from the time on this message. 2. Support Ruby Quiz 2 by submitting ideas as often as you can! Visit . 3. Enjoy! Suggestion: A [QUIZ] in the subject of emails about the problem helps everyone on Ruby Talk follow the discussion. Please reply to the original quiz message, if you can. -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- ## Sudoku Generator (#182) _Quiz idea provided by Lloyd Linklater_ A bit over three years ago, we had a quiz to [solve sudoku puzzles] [1]. Now it's time to write a script that generates sudoku puzzles. The output of your script should be the puzzle to solve. (Since we already have solver scripts from quiz #43, there is no need to output the solution.) In addition to generating the puzzle, you should adhere either one or the other of these two methods: 1. Reduce a generated puzzle to the fewest clues that will still suffice for finding a solution. To your output, include an estimated difficulty level. 2. Accept a command line parameter: the estimated difficulty level. Generate the puzzle such that it roughly matches that difficulty level. The difficulty level should be a number from 1 (easiest) to 10 (hardest). Difficulty level, obviously, is somewhat subjective. However, there are [various sudoku techniques][2] that may be able to help you decide whether a puzzle is more difficult or not. Some suggested metrics include: number of clues, number of "gimmes", number of possible solutions, cascading singletons, etc. [1]: http://rubyquiz.com/quiz43.html [2]: http://www.sadmansoftware.com/sudoku/techniques.htm