The three rules of Ruby Q. 2:
Please do not post any solutions or spoiler discussion for this
quiz until 48 hours have passed from the time on this message.
Support Ruby Q. 2 by submitting ideas as often as you can!
Suggestion: A [QUIZ] in the subject of emails about the problem
helps everyone on Ruby T. follow the discussion. Please reply to
the original quiz message, if you can.
Sudoku Generator (#182)
Quiz idea provided by Lloyd L.
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:
Reduce a generated puzzle to the fewest clues that will still
suffice for finding a solution. To your output, include an estimated
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 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.