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 Version History

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 (2021). 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.

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

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!