Function Repository Resource:

SudokuSuguruAssistant

Source Notebook

Open an interface for entering and interactively solving given or generated sudoku and suguru puzzles

Contributed by: Fred Simons

ResourceFunction["SudokuSuguruAssistant"][]

opens an interface for interactively entering and solving a standard sudoku puzzle.

ResourceFunction["SudokuSuguruAssistant"][{r,c}]

opens an interface for a suguru puzzle with r rows and c columns.

ResourceFunction["SudokuSuguruAssistant"][type]

opens an interface for a single sudoku puzzle of the specified type.

ResourceFunction["SudokuSuguruAssistant"][{loc1,type1},{loc2,type2},]

opens an interface for a multi-sudoku puzzle.

ResourceFunction["SudokuSuguruAssistant"][str]

opens an interface for a puzzle specified by data in the string str.

Details

The typei specifies the (sub)sudoku type: "standard", "diagonal", or "jigsaw".
The loci for multi-sudoku puzzles are strings and specify the row and column of the top-left corner. For example, "R4C7" if the corner lies in row 4, column 7. When the type is "standard", the loci can be used instead of the list {loci, typei}.
The result is an interface whose main component is an empty sudoku or suguru. For a jigsaw (sub)sudoku or a suguru the block or region lines still have to be drawn. That is done by clicking the corresponding cell borders. For removing a line element, click that line element once again.
For entering the clues, move the cursor to the cell and type the digit. For removing a clue, click on that clue.
Instead of entering a puzzle manually, a puzzle can also be generated using the Generate button, if available.
At any stage when interactively entering or solving the puzzle, choosing the item String under the button 'More…' will give a string containing information about the sort of puzzle and the line elements and clues you entered so far. This string is placed on the clipboard as well and can be used as an argument of the function.
Press the Validate Input button after entering the puzzle. If the input is correct, a green Start Solving button will appear, together with an indication of which rules are required to solve the puzzle. Otherwise, a message will indicate what is incorrect in the input.
Pressing the Start Solving button switches the assistant to solve mode. The puzzle can then be solved exactly as one would do using pencil and paper. To place a number in an empty cell, position the cursor in that cell and type the number. To remove a placed number, click on that number.
When candidates are not displayed, empty cells can be used to make notes about possible candidates. To enter a candidate, move the cursor to the cell and type the candidate while holding down the left mouse button. To remove an entered candidate, enter the same candidate again. Candidates are shown in a much smaller font, resembling handwritten notes. Entering candidates is unrestricted: any candidate can be entered in any cell, even if it cannot occur there. There is no relation between these handwritten candidates and the candidates of the puzzle.
Right-clicking on a cell containing handwritten candidates replaces the puzzle candidates in that cell with the handwritten ones, so that they are used in the computation of a hint. The font then changes to the standard font. This association can be undone by right-clicking the cell again.
Whenever a number is placed or handwritten candidates are applied, the input is compared with the solution of the puzzle. If it conflicts, an error message is displayed.
At any time during solving, a hint can be requested by pressing the Hint button. A hint consists of a sequence of reductions that can be applied step by step, ending in a single placement. Clicking on any reduction highlights the relevant cells using color coding. Each reduction indicates the logical rule it uses. More information about these rules can be found by selecting Documentation under the More… menu.
When candidates are shown, the next hint is generated automatically.
The Configure Rules item under the More… menu allows the user to specify which logical rules are used, and in which order, when computing a hint or determining the level.
The Solution item under the More… menu shows the solution of the puzzle.
The Edit item under the More… menu goes back to the enter mode.
The New item under the More… menu allows the user to start solving a new puzzle.

Examples

Basic Examples

This opens an interface for entering and solving a 6x6 suguru:

In[1]:=
ResourceFunction["SudokuSuguruAssistant"][{6, 6}]
Out[1]=

If you have a puzzle at hand, click the cell borders to draw the regions, enter the clues, and press Validate Input to obtain:

Instead of entering a given puzzle manually, you can press Generate. The result will be something like:

The assistant needed the logical rule clusters three times and conjugate chains once to solve this puzzle. If you are looking for a simpler or more difficult puzzle, you can press Edit and then Generate again.

Pressing Start Solving results in:

Press ShowCandidates to inspect the candidates:

Or press More… and then Solution to inspect the solution:

Press Clear to return to the solve screen and start solving. After placing some numbers and making some notes, we might arrive at something like:

The numbers that we placed are shown in italics. Moreover, we observe that in the third region, candidate 2 can be placed only in cells R2C4 and R3C4, so we enter that digit in these cells while holding down the left mouse button. The result is shown in a small handwriting-like font. Next, we observe that cell R3C5 cannot contain 2, 3, or 4, so the only candidates in that cell are 1 and 5. We enter 1 and 5 while holding down the left mouse button and then right-click on that cell to indicate to the assistant that these are the only candidates. The result is shown in the standard font.

Continuing this way, after some time we might arrive at:

Pressing Hint suggests how we could proceed:

Here we also clicked ConjugateChain to display the color information. Look at the grey cells and follow the arrows. If 1 is not in R4C1, then it must be in R5C1, not in R6C2, and therefore in R4C3. Thus, candidate 1 must be placed in one of the yellow-marked cells and therefore cannot be placed in the green cell R3C2. Applying this reduction yields a single in cell R3C2, as indicated in the second line of the hint. Press Apply to continue solving.


This opens an interface for entering and solving a standard sudoku:

In[2]:=
ResourceFunction["SudokuSuguruAssistant"][]

Press Generate to create a random puzzle:

Press More…, string to generate a code string for the puzzle:

The string is copied to the clipboard. It can be used to reopen the puzzle:

In[3]:=
ResourceFunction[
 "SudokuSuguruAssistant"]["lvPg&Hj!29WaKdTSX1gzmbTvzbasxqiYueme%ooGy%0C"]


This opens the interface for entering and solving a multi-sudoku consisting of a jigsaw sudoku and a diagonal sudoku:

In[4]:=
ResourceFunction[
 "SudokuSuguruAssistant"][{"R1C1", "jigsaw"}, {"R7C7", "diagonal"}]

Note that there is no Generate button. This is the result after entering a puzzle manually and selecting String from the More… menu:

The string can be used to enter this puzzle directly:

In[5]:=
ResourceFunction[
 "SudokuSuguruAssistant"]["3sAfeaTYJYrg94ngDy8Ddo5A%q&h70TYhdh7c%F&L1nebZvDoDU3Ss77xlXJm$$ZizV3qPEI584hex78v1W|4nxNL|HkT4pZLpbSdRGCQBLTl0usa0ZQ$%WfSnmZrbde"]

Publisher

Fred Simons

Requirements

Wolfram Language 13.0 (December 2021) or above

Version History

  • 2.0.0 – 13 April 2026
  • 1.0.0 – 17 September 2025

Related Resources

License Information