Fill in the grid so that every row, every column, and every 3x3 box contains the digits 1 through 9.
The sudoku interface lets the user solve sudoku puzzles graphically. The puzzles are either generated by the built-in puzzle generator (three difficult levels can be chosen), randomly taken from the built-in database of 160 really difficult puzzles, entered manually by the or loaded from three standard ascii sudoku files 'Simple Sudoku' (.ss), 'Sudoku Puzzle' (.sdk) or 'Sudoku Puzzle Collection' (.sdm).
The game board can be saved to Simple Sudoku and Sudoku Puzzle files.
The current board can also be exported to various image-files, such as, png, bmp, eps or tiff. The board can be printed and also copied to clipboard to be pasted as an image in for example a MS Word document.
The sudoku game can be played using either mouse or keyboard (or both). Move around marker using arrow keys and add a number using number keys. Delete, backspace or 0 (zero) will remove number from board. With mouse you move around marker using left-click and reach a context-menu with number choices using right-click.
Illegal characters can not be entered.
The sudoku game has two built-in puzzle solvers, one quick and one 'human-like'. The quick one is based on Dancing Links (DLX), a technique suggested by Donald Knuth to efficiently implement his Algorithm X. Algorithm X is a recursive, nondeterministic, depth-first, brute-force algorithm that finds all solutions to the exact cover problem. The human solver finds Naked Singles, Hidden Singles, Naked Pairs and Locked Candidates 1 and 2. If this is not enough it takes a guess and tries to solve it recursively.
The dlx-solver is used for solving and generating puzzles while the human puzzle is used to generate a log of solution steps.
The game allows for automatic solving of the whole puzzle or just one single square. To help the user one can show all possible candidates for unfilled squares as well as showing all mistakes in a different color as well as making it impossible to make an illegal mark.
Extra Game Features:
The sudoku game has Undo and Redo functionality that can be reached from the Edit-menu, Context-menu or by the shortcuts Ctrl-Z (Undo) and Ctrl-R (Redo).
Every time one restarts a game a timer is started. Current time can be shown using Ctrl-T or enable/disabled from the Help menu.
A coloring help of possible candidates can be added to the matrix from the colored numbers in the toolbar.
sudoku % Start Main Sudoku Interface
sudoku('uitest') % Solve all 160 boards in database (test set)
Per-Anders Ekstrom (2021). Sudoku (Dancing Links Solver) (https://www.mathworks.com/matlabcentral/fileexchange/14073-sudoku-dancing-links-solver), MATLAB Central File Exchange. Retrieved .
Hello Kiko Kiko, thanks for mentioning. My first guess is that you have an old Matlab version, this Sudoku game was developed using release R2006a. At line 176 I use a function named arrayfun introduced in R14sp3, so if you have an older version than that it will not work.
I think there is a bug around line 176.
Very nice graphics and an excellent logic!
A superb Sudoku tool. Great help. Everything I tried worked as it should. It can generate game layouts for you.
A minor complaint - this tool almost makes solving a puzzle too easy. ;-) Well done anyway.
Inspired by: Sudoku! (v3.4)
Find the treasures in MATLAB Central and discover how the community can help you!Start Hunting!