Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Generators ¶
func Generators() []string
Generators returns the names of all available Generators.
Types ¶
type Generator ¶
type Generator interface {
Debug() bool
Name() string
Generate(grid *sudoku.Grid) (*sudoku.Grid, error)
RNG() *rand.Rand
}
Generator defines a method to take Difficulty as input and generate a valid and solvable Sudoku Grid.
func BackTrackingGenerator ¶
BackTrackingGenerator generates a Grid with the back-tracking algorithm.
func BruteForceGenerator ¶
BruteForceGenerator generates a Grid with brute-force. There is no intelligent algorithm to it and this has a chance to fail and hence the obscene amount of retries that are attempted.
type Option ¶
type Option func(g Generator)
Option customized the behavior of one or more Generators.
func WithBlockOrder ¶
WithBlockOrder customizes the order of priority of blocks to be filled.
Applies to:
- BackTrackingGenerator
func WithDebug ¶
func WithDebug() Option
WithDebug enables debug logging.
Applies to:
- BackTrackingGenerator
- BruteForceGenerator
func WithProgress ¶
func WithProgress() Option
WithProgress enables the Generators to show each step of the solution. The 'waitInterval' value dictates how long to wait between each cycle.
Applies to:
- BackTrackingGenerator
- BruteForceGenerator
func WithRNG ¶
WithRNG customizes the WithRNG used by the Generator.
Applies to:
- BackTrackingGenerator
- BruteForceGenerator
func WithSubGridOrder ¶
WithSubGridOrder customizes the order of priority of SubGirds to be filled.
Applies to:
- BruteForceGenerator