Class StandardPuzzleGenerator
Generates standard Sudoku puzzles.
Inherited Members
Namespace: SudokuSpice.RuleBased
Assembly: SudokuSpice.dll
Syntax
public class StandardPuzzleGenerator : PuzzleGenerator<PuzzleWithPossibleValues>
Constructors
| Improve this Doc View SourceStandardPuzzleGenerator()
Declaration
public StandardPuzzleGenerator()
Methods
| Improve this Doc View SourceGenerate(Int32, Int32, TimeSpan)
Generates a puzzle that has a unique solution with the given number of squares set.
Be careful calling this with low values, as it can take a very long time to generate
unique puzzles as the value of numSquaresToSet
approaches the
minimum number of clues necessary to provide a unique puzzle of the given
puzzleSize
.
Declaration
public PuzzleWithPossibleValues Generate(int puzzleSize, int numSquaresToSet, TimeSpan timeout)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | puzzleSize | The size (i.e. side-length) of the puzzle to generate. |
System.Int32 | numSquaresToSet | The number of squares that will be preset in the generated puzzle. Valid ranges are 0-1 for puzzles of size 1, 4-16 for puzzles of size 4, 17-81 for puzzles of size 9, 55-256 for puzzles of size 16, and 185 - 625 for puzzles of size 25. Note that the lower bounds for puzzles sized 16 or 25 are estimates from this forum: http://forum.enjoysudoku.com/minimum-givens-on-larger-puzzles-t4801.html |
System.TimeSpan | timeout | The maximum timeout during which this function can search for a unique puzzle.
Especially useful when trying to generate puzzles with low
|
Returns
Type | Description |
---|---|
PuzzleWithPossibleValues | A standard Sudoku puzzle with a unique solution and |
Exceptions
Type | Condition |
---|---|
System.ArgumentOutOfRangeException | Thrown if |
System.TimeoutException | Thrown if no valid unique puzzle is found within the specified
|