The applet above is meant to offer help adapted to
what the player wants.
The assistance may consist in
-
playing without pencil
-
simple backtracking when needed
-
colored hints for the techniques to use
-
fast simplification of the grid by simple clicks
-
estimation of the complexity of the puzzle by exploring the techniques
required to solve it
How to use this program
The easiest is to play the given puzzle. It's randomly selected in
a list of 48826 minimal puzzles compiled by
Gordon Royle.
The menu
Load lets you play an other of Royle's puzzle or one of 1465 diabolic puzzles
from
magictour, more of this further on.
You can also begin by
paste a
text version or a
screen capture
of some sudoku puzzle of your choice into
the applet (please notice that to do so you must
enable clipboard interaction).
More laboriously, you can
enter the values by hand.
Edite by hand
Check that "Edite a new puzzle" is enabled. Fill in the numbers
of your grid (verify that the last number is correctly entered). To enter a number, click the cell, hit
the number on your keyboard, then click another cell or use the arrows. To erase a number, double-click
the cell, select what you want to erase, and hit "del".
Play
When your grid is ready, enable "
Play the puzzle". You would
probably also select "
candidates".
You can then play (without help from the program) by selecting a cell and then edit it's new content in
the small editor called "
Edite sélected cell".
You can also see the suggestions of the program if you enable the corresponding "
Techniques".
A
right clic in a cell will pop up a menu which lets you simplify the puzzle by the technique
attatched to this cell, and - for the more complex techniques -
enhance the cells and the
candidates which are implied.
The buttons "
Simplify" offer a means to browse rapidly towards the solution. Each set of
techniques has it's own color and button.
If it's necessary you can backtrack step by step with "
undo", and also "
mark" a step to
"
return" there later (usefull in case of trial and error, but there's only one mark available).
If you vant to estimate if a given grid is difficult or not, begin by enabeling two or three of the
easiest techniques, then use the corresponding buttons to simplify the grid. If at some moment the
program doesn't give a hint for the next step, enable one other technique. If still no suggestion
appears, disable that one and try another. You may find (very difficult) grids that this program can't
help you to solve completely by hints.
Import / export
Import of an image and OCR
(Import / export uses the cliboard:
you must enable clipboard access
in order to use it).
Lots of sites offer images of sudoku puzzles ready to copy or print (format JPG, GIF or PNG).
You can then import the image into the program by simply drag the image and drop it on the applet.
When the proposed puzzle is not of such a format, you can import it by first doing a
screen capture and then import the capture.
To do so, use the screen capture utility of Vista or
Windows 7 or a screen capture program like
PrtScr.
First, capture the image of the puzzle by selecting the corresponding
rectangle of the screen, including the boarding line of the sudoku grid;
next copy the capture to the clipboard, and then select "Import/export > paste"
in the menu of my program.
This homemade optical character recognition is not perfect, but should function for most grids having a
good contrast and a sharp font.
Import of a puzzle in text format
(Import / export uses the cliboard:
you must enable clipboard access
in order to use it).
The puzzle must conform to one of the simple following text formats:
9 lines of 9 characters as in the following example (the periods are transformed into blanc cells by the
program)
....81.9.
.43......
...9..26.
......6..
...2..7..
28..69...
472......
....5.3..
3.6.24...
More generally the program accept any text by ignoring any character other than
.0123456789 where
the period "
." and the digit"0" are interpreted as empty cells.
3 2 9 | 4 1 . | 7 . .
. . . | . . . | 4 . .
. . 5 | . 2 . | . . .
---------------------
5 . . | . . . | 3 . 6
. 6 . | 7 . 3 | . 9 .
8 . 7 | . . . | . . 2
---------------------
. . . | . 4 . | 8 . .
. . 6 | . . . | . . .
. . 3 | . 7 2 | 9 5 1
and
800009406060240013000600005026300008380000050400807360908003000610082030203900001
will therefore be accepted (try to copy-paste them into the applet).
A tabulation-separated position-based text format is also accepted (the tabulations give the positions,
a digit may or not be present at any position).
It's also possible to import and export puzzles with the candidates as recommended on the site
Sudopedia.
Some sites offer puzzles conformant to one of these formats. For example
magictour from which I recommend this list of
1465 hard puzzles. Some of these (especially at the beginning)
demand the Denied Promotion technique. You will find easier puzzles at
paulspages (select a puzzle to play then use
Import/Export button) or at
sudocue. An example of the
tabulation-separated copyable puzzle format is used by
lemo: clic on one of the three
3x3 puzzle types, then
select the whole puzzle grid and copy-paste it into my applet. The dayly press is a source for a variety
of sudoku puzzles, but if no internet site offers you a compyable version you will have to enter it by
hand.
When you have entered a grid by hand, remeber to export it and paste it into a word editor (then you can
save it to your harddisk). In this way you can easily copy-paste it back into the applet later on. Be
aware that if you leave the Sudoku page, your grid will be empty when you turn back. Here copy-paste
before leaving may be a rescue.
Enable clipboard import / export
If you experience problems when copy-pasting to the applet it's probably because your Java
configuration will not let you do so.
To enable applet copy-pasting do the following:
Open a simple text editor like
EditPad Lite.
Search for the file
.java.policy (inclusive the beginning period, it's part of the name)
in your home directory (for example with Windows XP, if your identity is "myself" your home directory
will probably be "C:\Documents and Settings\myself"), open it and add the three following lines at the
end of the file:
grant codeBase "http://areu.free.fr/sudoku/*" {
permission java.awt.AWTPermission
"accessClipboard";
};
If the file does not exist, create it, and if your favorite editor does not let you create a file whose
name begins with a perod, use EditPad lite!
An alternative is to use the
policytool of your
Java installation: start > execute policytool.exe.
Vocabulary and references
Sudoku is a puzzle, a "brain game". The goal is to complete a grid of 9x9 cells in such a manner that
each line, each column and each 3x3 box conains each of the numbers 1 to 9.
The site
Sudoku of the day
give excellente explications on the techniques used to solve a Sudoku puzzle. You will also find examples
of step by step solutions.
If you want a very in-depth documentation, take a look at
Sudopedia.
Here's a summary of the techniques implemented
-
singles = single candidate
-
blocked = candidate line
-
paires = naked pairs
-
triplets = naked triples
-
n-tuples = naked groups of n candidates
-
n-fishes = X-wing, Swordfish, Jellyfish
-
wings = XY-Wing, XYZ-Wing
-
chains = XY-chains and Nice loops. Please note that in some cases the search for nice loops
can take a rather long time!
-
the prefix h. means "hidden" : single position, multi-line, hidden
pairs, hidden triples...
-
The last technique, Denied Promotion, is a technique that you can't expect
to use by hand except in its simplest forms. I used
this text of Bob Hanson as basis.
Here's the idea: you choose a candidate in a cell and promote it. This promotion will
imply a simplification of the puzzle, and some other candidates in other cells will become single candidates or hidden singles
in their line (or column or box). The techniques "single" and "hidden single" will
let us promote these candidates too. We thus have a chain reaction which can end in three possible ways
- an error appeares in the puzzle. The initial candidate can not be promoted. Then we can simply take it
away from the cell!
- no new promotion is possible. No conclusion is then possible, we can not eliminate the candidate
- we find the solution of the puzzle.
This last possibility make some people pretend that this sort of technique is not a true "technique" but just "trial end error".
That's why my algorithm comes with two sorts of "blindness"
- if the puzzle is resolved, the algorithm will only see that no new promotion is possible ; this case is thus treated
just like the second type of end of the chain reaction
- the number of iterations (chain reactions) is limited.
The default value is 2 (possible values go from 1 to 20). It's quite realistic to prtend that for 1 and 2
this technique may be done by hand, it's then a "normal" technique.
The technique may be generalized, indeed after the promotion of the initial candidate one may
use other techniques than "single" ou "hidden single" to simplify the puzzle and try to reveal an error.
Three "forces" are at your disposal in the menu:
- basic, the iterations only use "single" and "hidden single"
- advanced, we add "blocked" and the family of "pairs", "triplets", "n-tuples"
- complete, all techniques but "Denied Promotion" are used.
When activated, the algorithm will search for the first denied promotion found in each cell.
It may of course exist others in the cell, but these will not be searched for this time.
You should notice that this technique may demand huge amount of time to analyse a puzzle,
indeed, for each cell it will spend the same time as normaly for a whole puzzle
multiplied by the number of iterations needed and the number of candidates examined
in the cell!
It's a good idea to keep an eye on the Java Monitor in order to see that things are working
and not to confuse waiting time with a software crash!