Wolfram Function Repository
Instant-use add-on functions for the Wolfram Language
Function Repository Resource:
Generate a sudoku puzzle
ResourceFunction["GenerateSudokuPuzzle"][] generates a 9×9 sudoku puzzle with half of the elements exposed. | |
ResourceFunction["GenerateSudokuPuzzle"][d] generates a d2×d2 sudoku puzzle with half of the elements exposed. | |
ResourceFunction["GenerateSudokuPuzzle"][d,p] generates a d2×d2 sudoku puzzle with p percent of the elements exposed. |
Generate a standard sudoku puzzle:
In[1]:= | ![]() |
Out[1]= | ![]() |
Display the results using the resource function DisplaySudokuPuzzle:
In[2]:= | ![]() |
Out[2]= | ![]() |
Solve the resulting sudoku puzzle using the resource function SolveSudokuPuzzle to confirm that the reference puzzle is obtained:
In[3]:= | ![]() |
Out[3]= | ![]() |
Generate a 16⨯16 sudoku puzzle with 70% of the elements exposed:
In[4]:= | ![]() |
Out[4]= | ![]() |
Display the results using the resource function DisplaySudokuPuzzle:
In[5]:= | ![]() |
Out[5]= | ![]() |
If the specified exposed percentage is too low then the function will return a puzzle with the smallest number of elements exposed such that the resulting sudoku puzzle is unique:
In[6]:= | ![]() |
Out[6]= | ![]() |
In[7]:= | ![]() |
Out[7]= | ![]() |
Solve the resulting sudoku puzzle using the resource function SolveSudokuPuzzle to confirm that the reference puzzle is obtained:
In[8]:= | ![]() |
Out[8]= | ![]() |
This work is licensed under a Creative Commons Attribution 4.0 International License