Generate a puzzle and its solution.
[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 )
a boolean. Set to %t to display the state of the matrix. (default = %f)
the number of givens to put in the puzzle (default = 28)
the maximum number of loops (default = 100)
a solution where to start from (default = automatically generated)
the 9x9 puzzle matrix, with zeros for unknown entries
the 9x9 solution matrix without any zero
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.
"Sudoku Creation and Grading", Andrew C. Stuart, 3rd February 2007