...
Generating Solvable Puzzles
A separate, stand-alone, fully-functional utility has been provided that can generate 9x9 Sudoku puzzles from a store of over 50,000 puzzles. The utility consists of a singleton utility class GeneratePuzzle
and a companion GUI application to run it, GeneratePuzzleApp}. The utilities utilize the files in the {{HW11\data\puzzle_src
folder.
- .In DrJava, right-click the {{GeneratePuzzleApp} class and select "Run File" to start the utility.
- Select a file from the drop-list (yes,
4,txt
is missing--broken link on the download page). The higher the number, the harder the puzzles. - Each file contains about 10,000 puzzles. Use the number spinner to choose or type a puzzle number from 1-10,000 (approx.). Specifying "0" as the index will cause the utility to randomly select a puzzle.
- Click the
Generate
button and the puzzle will appear in the main display area of the utility. - Click the
Save
button to save the generated puzzle in a format that the Sudoku solver application can now read.
This should keep you busy for a while, though your Sudoku solver should be able to easily solve any puzzle in the collection.
Note: Your Sudoku solver should be able to solve a completely blank puzzle (all dashes, not empty)!
Programming Tips
Mutating a value outside of an anonymous inner class:
...
As any seasoned Sudoku player knows, there are other reduction rubrics that can be applied to more quickly reduce a board. For instance, if an unsolved cell includes a value choice that no other unsolved cell in its cell contains, then the cell must have that value (this can be extended to a sub-set of values spread across multiple cells in a cell set). Can you incorporate additional reduction rubrics in a modular, flexible and extensible fashion?
Challenge! Come up with a Sudoku puzzle (any order) that your solver can solve but the staff's solution cannot!
Submission
Submit via Owlspace a .zip
file containing the entire HW11 folder, including all the support code and data. Don't forget to add as header to the GameModel
class, your names and ids.