Code covered by the BSD License  

Highlights from
sudokon

4.625

4.6 | 8 ratings Rate this file 12 Downloads (last 30 days) File Size: 14.78 KB File ID: #9852
image thumbnail

sudokon

by Carl de Boor

 

01 Feb 2006 (Updated 13 Jan 2011)

A GUI for helping you to solve sudoku puzzles onscreen

| Watch this File

File Information
Description

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.

MATLAB release MATLAB 7.1.0 (R14SP3)
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Comments and Ratings (8)
05 Feb 2006 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.

12 Feb 2006 juan sandoval  
13 Feb 2006 f f  
11 Mar 2006 dario mora  
30 Aug 2006 Gordon GIFFORD

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.

30 Jun 2007 Victor Alderete

We need code for printing a matrix into a gui

10 Dec 2010 John D'Errico  
13 Dec 2010 Dmitry

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 )

Please login to add a comment or rating.
Updates
14 Feb 2006

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)

23 Feb 2006

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

06 Mar 2006

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.

09 Mar 2006

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.

15 Jun 2006

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.

21 Sep 2006

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

26 Feb 2007

correct a mistake; improve look of optional printout.

14 Feb 2008

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

21 Jan 2009

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.

02 Aug 2010

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.

13 Jan 2011

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

Tag Activity for this File
Tag Applied By Date/Time
game Carl de Boor 13 Jan 2011 08:29:52

Contact us at files@mathworks.com