SuDokuPuzzle
This class represents a rectangular Sudoku puzzle.
Author: Adam T. Yarnott, Blue Ninja Software
Modified: 12-18-2005
Class Diagram
SuDokuPuzzle
Public:
Types:
| Name | Description |
|---|
Constraints |
Indicates the constraints that are enforced for the game. |
MoveResults |
Indicates the result of a move.
|
Properties:
| Name | Description |
|---|
Cols (get) |
Returns the number of columns for the game. |
Constraints (get) |
Returns the constraints enforced in the game. |
Digit (get) |
Returns the digit at the given square.
|
IsGiven (get) |
Returns whether the specified square was a given.
|
MaxDigit (get) |
Returns the highest digit allowed in the game. |
Region (get) |
Returns the numbered region to which a square belongs.
|
Region (let) |
Sets the numbered region to which a square belongs.
|
Rows (get) |
Returns the number of rows for the game. |
Methods:
| Name | Description |
|---|
CheckMove |
Determines the result of a specified move.
|
GetIndexFromMatrix |
Returns the linear index of a square, based on its row and column.
|
Init |
Initializes the game board to the given dimensions.
|
IsPuzzleComplete |
Returns whether the entire puzzle is completed. |
IsRegionComplete |
Returns whether the specified region is completed.
|
MakeMove |
Attempts to make the specified move, and returns the result.
|
NewGame |
Resets the board and initializes the given squares.
|
SetMatrixFromIndex |
Sets the row and column matrix for a square based on its linear index.
|
Events:
| Name | Description |
|---|
Change |
Raised to indicate that a square has changed.
|
Remarks
Since the digits and regions are identified numerically, a GUI application can
interpret these as numbers, letters, symbols, colors, etc.
Also, this class can support irregular or non-rectangular regions. This allows a GUI
to produce many variations on the Sudoku theme.
Features include:
- Variable puzzle dimentions.
- Regions are defined on a per-square basis, so any shape or pattern is supported.
- Simple to integrate into a GUI application.
- Easy access to see what the result of a move will be, before making it.
This allows for pre-move validation without causing errors.
- Variable constraints, which can include any of:
- Digits must be unique per row.
- Digits must be unique per column.
- Digits must be unique per region.
- Configurable number of Givens on a new game.
- Configurable number of allowable digits.
- Per-square change events simplify making a GUI application.
- Handy utilities to translate between Row, Column coordinates and a linear Index.
Documentation compiled on Wednesday, December 21, 2005 using VBDOX (c) M.Stamenov
Documentation by Adam Yarnott, Blue Ninja Software