This preview shows page 1. Sign up to view the full content.
Unformatted text preview: 15-121: Introduction to Data Structures Exercise 10/08/2009 Sudoku Lab Fall 2009 Due: Thur, Oct 8 end of lab YOU ARE ENCOURAGED TO WORK ON THIS LAB IN PAIRS. Assignment: (worth 5 exercise points) Download the file Sudoku.zip In this folder is a program that solves Sudokus using an backtracking method for an exhaustive search of the state space (If you are not familiar with Sudokus, look it up, or ask someone.) In the SudokuTester file, there is a main method. The second line is:
puzzle = getPuzzle(SIMPLE1); // replace the parameter with a constant from above The argument SIMPLE1 can be changed to a number of different puzzles. • When the puzzle is displayed, the original puzzle is in black, while the "solution" is in blue. • The puzzle is represented as a 2-dimensional array of characters. '1' .. '9'. Empty places are represented by a space. 1) Run the program with different constants. The program is unlikely to run very quickly on the Easy, Medium, or Hard puzzles. 2) Look at the code in SudokuSolver. Ask any questions you may have. In particular, you should convince yourself that it works and that you understand HOW it works. The comments are deliberately skimpy.. 3) Increase the efficiency of the program by modifiying the method getOptionsForThisSpot so that it does not automatically include all 9 digits as possibilities. Instead, it should only include those numbers that are NOT already in the row, already in the column, or already in the 3x3 box. 4) Implement any other pruning possibilities to speed up the code that you can come up with. Handin: • Create a zip file containing all of the necessary java files. Submit this zip file via handin. If you have problems, contact me. • If you worked in a pair, turn in only one copy, with both of your names in the comments. ...
View Full Document
This document was uploaded on 12/19/2009.
- Spring '09
- Data Structures