<< Generate Generate sudoku_delrandom >>

Sudoku Toolbox >> Generate > sudoku_create

sudoku_create

Generate a puzzle and its solution.

Calling Sequence

[puzzle,solution] = sudoku_create ( )
[puzzle,solution] = sudoku_create ( verbose )
[puzzle,solution] = sudoku_create ( verbose , clues )
[puzzle,solution] = sudoku_create ( verbose , clues , maxiter )
[puzzle,solution] = sudoku_create ( verbose , clues , maxiter , solution )

Parameters

verbose:

a boolean. Set to %t to display the state of the matrix. (default = %f)

clues:

the number of givens to put in the puzzle (default = 28)

maxiter:

the maximum number of loops (default = 100)

solution:

a solution where to start from (default = automatically generated)

puzzle:

the 9x9 puzzle matrix, with zeros for unknown entries

solution:

the 9x9 solution matrix without any zero

Description

Creates a puzzle and its solution.

This algorithm is based on the suggestions provided by Stuart. The target number of given is computed as a bell-curve around 18. There is never less than 32 givens.

This algorithm creates sudokus which are almost symetric.

Examples

[puzzle,solution] = sudoku_generate ( 1 )

Authors

Bibliography

"Sudoku Creation and Grading", Andrew C. Stuart, 3rd February 2007


<< Generate Generate sudoku_delrandom >>