Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  • In any line
  • In any column
  • In any on the 3*3 sub-puzzles

 Sudoku is not limited to 9x9 boards.  An "order" for a Sudoku puzzle can be defined, and thus a Sudoku puzzle is an order^2 x order^2 matrix.    A regular Sudoku puzzle is this order = 3.   This is Rice, so our system should be able to handle any order of Sudoku puzzle.

For more information of the game of Sudoku, visit: http://en.wikipedia.org/wiki/Sudoku

...

A Sudoku puzzle as needed for this assignment may not be well formed and in general may have no solutions or multiple solutions.   Your solution must be able to handle these situations!   (You only have to find one solution, if one exists however, not all solutions.)

Supporting Code Download

The support code provided contains a DrJava project and a few simple Junit tests.  The code download is coming "Real Soon Now" ...

The assignment

The purpose of this assignment is to build a Java solver that finds all of the different solutions of the game using a constraint-based approach.

...

  • Irreducible - the reduction pass did not change any values but at least one cell is unsolved. 
  • Solved - all the cells were solved already or became solved
  • Unsolvable - a cell somewhere has or ends up having no value choices left, i.e. and empty HashSet of values. 
  • Reducible - a change to the number of values for a cell somewhere occurred. 

...

See the code details wiki page for explanations of the return types of the reduction and solving methods of GameModel.

 


The support code provided contains a DrJava project and a few simple Junit tests.  The code download is coming "Real Soon Now" ...  

Supporting Code Details 

Programming Tips

Mutating a value outside of an anonymous inner class:

The quandry is that a variable that is declared outside of an anoymous inner class that is accessed by an anonymous inner class must defined as final (Thanks Sun! Argh...).   There a classic "hack" to get around this:

Define your variable as a one-element array.

For instance:

Wiki Markup
{{final int\[\] x = new int\[\]\{0\}; }}

Wiki Markup
{{final ICell\[\] aCell = new ICell\[\]\{ new Cell()\}; }}

Controlling a loop from inside of an anonymous inner class

How to make copies of a board when you don't know which cell is the one you want to guess from

 Requirements

Your assignment is to implement:

Testing!

Extra credit

Incorporate the supplied GeneratePuzzle utility capability into the main Sudoku solve, both in the view and the model, to enable the user to generate and solve any of the 50,000 supplied puzzles. 

...