File Exchange

image thumbnail


version (14.8 KB) by Carl de Boor
A GUI for helping you to solve sudoku puzzles onscreen

1 Download

Updated 13 Jan 2011

View License

A GUI for solving sudoku puzzles (including those supplied by you) with various levels of help, from none (other than recording your choices and objecting to obviously wrong choices), to checking the number of solutions (which avoids struggling with puzzles that have more than one solution), to checking whether the current board has a solution, to showing in each cell not yet settled all the choices not ruled out by the basic rules, to pointing out choices that, with the present information, should be derivable or deletable (giving, optionally, more detailed information in the command window), to finishing the puzzle once only one choice is left in each of the cells not yet settled, to just printing out all possible solutions (if any), also saving the current board for later reloading, or printing it out in various ways for offline work.

As you work on more difficult puzzles, the hints can provide good training, and the checks can avoid frustration.

In standard mode, you select a particular choice by left-clicking on it, and remove one of the choices by right-clicking on it.

It is always possible to return the board to how it was just before the last change made in a particular cell, by clicking on an empty space in that cell and then clicking the resulting `undo' button (helpful when you realize at some point that you have made a mistake, or when you are reduced to trying out a guess).

It is also possible with just one click to generate, from a given puzzle, many, many new puzzles with exactly the same level of difficulty.

sudokon(g), with g a 9-by-9 matrix with all its entries taken from 0:9, will set you up to work on that puzzle.

sudokon(n), with n from 1:12, starts you off with a particular puzzle, and a subsequent sudokon(n) with the same n gives a different puzzle but of the same difficulty, with the difficulty increasing with n.

sudokon (without any arguments) starts you off with a sudoku board showing all possible choices and expects you to enter the numbers of a puzzle one by one (by left-clicking on one of the choices shown).

No claim is made that the means of checking for consistency or of providing hints are optimized but the program is actually quite fast.

Cite As

Carl de Boor (2020). sudokon (, MATLAB Central File Exchange. Retrieved .

Comments and Ratings (9)

Peter Nave

Really phantastic! I added the possibility to prevent shuffling so that sudokus from newspapers can be entered.


This is very interesting tool! I think It can be quite useful for solving of sudokus with high level of complexity where it's really difficult to guess the answer. For easy sudokus I suggest do not use this program at all )

John D'Errico

Victor Alderete

We need code for printing a matrix into a gui


I really like the way this version plays. It can be used in such a fashion as to provide the help necessary to elliminate the tedium of keeping track of the possibilites, without solving the puzzle for you. The "check?" feature is a "fair" crutch to prevent going a long way down the path of frustration. I do not see how the hints are logically resolved, so I suspect they are really "hints". Thanks for the enjoyable game.

dario mora

f f

juan sandoval

John D'Errico

There are some nice features here. Its very fast. A really nice approach to hints.
Some minor things to improve - add an undo button that will allow you to undo many choices quickly, not just repair a single mistake. I made a mistake, and not realizing the result will be inconsistent, I followed through on many subsequent choices until I got stuck.
I also noted that the initial size of the window was too small, so that the bottom of each cell was hidden from view.
Finally, it would be nice to use color better. Flag each cell in green lettering when it is resolved. Flag a row or column or group of cells in blue when they are resolved. This would draws the eye immediately to that which still needs work.


Fixed a bug that affects the printing of the current sudoku board (introduced during the most recent improvement of sudokon).

Size of sudokon window now constant over all platforms and screens.
'permute' button added to generate, from present puzzle, a different one of the same level of difficulty.
Some trivial mlint complaints not dealt with for backward compatibility.


Description is updated. Also, now detailed hints are optionally printed in the command window which will be of great help to those learning to play sudoku.

description is updated, improved format of optional printout in command window, cells with hints are now highlighted, use of optional second argument is avoided.

correct a mistake; improve look of optional printout.

slightly larger font used to make clicking on digits more certain.

selecting/deleting a choice now takes just one (left/right) click; the current state can now be saved to a file and loaded again later; an undo button will undo the last change made anywhere; hints can be toggled between selections and deletions.

added the possibility to print out all solutions or to print out the number of possible solutions. Try it on
g = zeros(9); g(1,1:6) = 1:6; g(2,7) = 7;
Then try other sudoku programs on that.

added the option of showing, as a hint, not some choices to select but, rather, some choices to be deleted; added many more puzzles, and corrected an oversight ('undo' wiped out the grid lines in the printed board) and enlarged the printed board.

corrected a mistake, added an example, changed the tooltipstring for the undo button, adjusted the default size of the gui window, added a screenshot.

added a touch of color (but not a la review 1), bigger font on settled entries, acted on mlint complaints and tightened up things, made initial window big enough, reduced the number of hints (it's easier to figure out how they were derived)

MATLAB Release Compatibility
Created with R14SP3
Compatible with any release
Platform Compatibility
Windows macOS Linux
Tags Add Tags