Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
  • Homework 11: Sudoku Solver

Due: Friday 16 April 2010 at 9:59:59 am

 Under Construction!

...

  The text will be finished and support code uploaded "Real soon now"...  

The Sudoku Game

Sudoku is a 9*9 grid-based puzzle in which the goal is to place numbers from 1 to 9 in the grid squares taking into account specific constraints. The 9 * 9 puzzle grid can be seen as divided into 9 sub-grids of size 3*3. The 3 main conditions in the classic version of Sudoku state are that each square in the grid contains a number from 1 to 9 and a number cannot be repeated:

...

Supporting Code Details 

Running the Application

Starting the program:

Start the program by running the* Controller class.   The supplied DrJava project should already be set to run this class when you click "Run Project".The program will come up with an order 3 board with empty cells.   You can change the order by changing the number in the "Game Order" text box and press the Enter key.

*Entering values:*You can enter values into the cells by clicking on a cell and typing in a number and then either pressing the Enter key or by clicking on a different cell.To enter multiple values in a cell, separate the values by spaces and/or commas.    You can pre-load guesses this way.To enter all possible numbers into a cell, as the start of a game would require for cells that are not initially supplied, either enter all possible values or enter a dash, -.    Remember that an empty cell means that the puzzle is not solvable!    The start of a game should have some cells with single values and the rest with dashes.

Loading values from files:

Clicking the Load button will open up a standard file dialog window where you can browse to and select a values file to load.A values file is a normal text file that can be created on any text editor and has the following format:

  • Each line of text represents a single row of cells.
  • Each cell's values are separated from the other cell's values by a space or tab  (tab is recommended because it will keep your values nicely lined up and easy to read).
  • Multiple values for a single cell are separated by commas with NO spaces.
  • A dash means "all possible values" for the cell, e.g. for an order 2 board, "-" is a shortcut for "1,2,3,4"
  • A zero in a cell means that the cell is empty

A standard valid puzzle starting file should therefore have only single values and dashes.

Test files may have empty cells (zero) or cells with specific value choices in them to test specific features of the program.

Saving cell values from the program:

Clicking the save button will bring up a standard file dialog window where you can browse to and save the current cell values as a text file.  

The program does NOT warn you about overwriting existing files!!

The file format that the program saves is identical to the format used for loading, so cell values can be saved and re-loaded.

Test data available

Programming Tips

...

Submission

Submit via Owlspace a .zip file containing the entire HW11 folder, including all the files from the support code including those that you modified. Donand data.  Don't forget to add as header to the GameModel class, your names and ids.