For base classes of a solver, I see a good start with Cell
, ValidationRegion
, Board
, and Pattern
as your main classes.
Cell
: Has the current value of the cell, the remaining possible values of the cell, and if the cell is fixed or not.
ValidationRegion
: Has references to the appropriate 9 Cells
on the Board
. This class doesn't really need to know if it is representing horizontal, vertical, or a square regions, because the rules are the same. This class has a validate() method to verify that the current state of the region is possible.
Board
: Has the entire layout of Cells
, and initializes the fixed ValidationRegions
appropriately by passing the appropriate Cells
by reference. It also has a solve
method that applies Patterns
in a pre-defined order until a solution is reached or it is determined that no solution is possible (brute-force pattern must therefore be the last ditch effort).
Pattern
: Abstract class that has an apply(Board)
method that applies the given pattern to the specified board object (removes possibilities from Cells
and sets them when it knows there is only one possibility left). From Sudoku Dragon - Sudoku Strategy, you'll likely implement patterns like OneChoicePattern
, SinglePossibilityPattern
, OnlySquareRule
, etc.