Introduction

Sudoku is now a well-known and popular logic game. Please refer to Figure 1. At the start of a game the program presents a 9x9 grid of squares divided into rows, columns and 3x3 boxes. Most of these squares will be empty except for tiny candidate numbers at their top and bottom edges, but a few squares will already have their answers filled in. To solve the puzzle players must place each of the digits 1 - 9 exactly once in every row, column an box.

Contents

Sudoku Example

Sudoku Example

A screenshot from sudoku. The large digits are the current answers and the small digits are the remaining candidate answers for the individual squares. Click to see an animation showing the use of the hint button to solve this complete puzzle. The delay between images is 2 seconds.

Summary

The program starts with a randomly selected puzzle displayed. The 9 possible candidate answers are written in the unsolved squares. These numbers are buttons: left-clicking will delete a candidate, middle-clicking on its position will rewrite it, right-clicking will set it as the answer and delete any other candidates present. These actions are sufficient to finish a puzzle. But, if stuck, players can request hints including: Simple Filter(SF), Hidden Single(H1), Locked Candidate 1(L1), Locked Candidate 2(L2), Naked Pairs(N2), Naked Triples(N3), Naked Quads(N4), Hidden Pairs(H2), Hidden Triples(H3), X Wing(XW).

Simple Filter applies Exclusion Rule, and deletes candidates which are already set as answers to squares in the same box, row or column. Its repeated application is sufficient to completely solve easy puzzles. None of the programs 5000 built-in puzzles can be solved by Simple Filter alone, but all can be by using the algorithms listed above. If when working on an external puzzle no hint can be found using the algorithms listed above the program will set the answer for a random square(**). If the player right-clicks on the hint button, the program will repeatedly apply simple filter until it has no effect, clearing the candidates as it goes. Otherwise, a left click on the hint button will request a single hint. Hints are shown by highlighting the candidates that can be deleted in red and the reasons in green. While the hint is active (shown by the wand icon leaning backwards) clicking on the wand with the middle mouse button will cause a pop-up to appear containing a short explanation of the hint. A further left click will delete the red candidates and unhighlight the green candidates.

At the top of the display is a Toolbar. The jigsaw piece button at the left is a menu which has options for configuring the program and saving the current settings. Next to the jigsaw icon is a grid-like icon which is used for selecting a random puzzle from the program's 5000 built in puzzles; a wand for selecting and executing hints; a thumb for checking and correcting errors, and a sad smiley for showing the solution. To the right of this are 3 numbers. The first is the puzzle number, the next the puzzle difficulty and the next a clock which ticks every 5 seconds. The puzzle number display is also an input box: players can position the cursor over this area and type in a number between 0 and 4999 followed by "Enter" to load the corresponding puzzle. When a hint is requested the clock display is used to show a 2-letter abbreviation for the name of the hint found. The program will not report errors until the player clicks on the thumb or requests a hint. Errors are reported by the thumb turning down and the incorrect squares being highlighted. A further click on the thumb will correct the error(s) and undo all subsequent changes. At any time, typing "Enter" will restart the current puzzle.

The puzzle menu has an option to choose font sizes.

Colours

Using an option in the puzzle menu players can set the colours of the boxes, the text, and the various highlights. The gaudy adjacent screenshot serves as a warning.

Colour Change

Colour Change

The colours used can be changed by the player.

Playing

Each of the squares which have yet to be given a value contain tiny "candidate" numbers 1-9. These are buttons which can be left clicked for removal or middle clicked for setting the number for the square. A right click will replace a deleted candidate. In this way they can be used as a simple notepad while working towards the solution for each square. If the player cannot make progress, hints are available.

Using Hints

Hints are requested using the wand icon in the Toolbar. Two modes can be set via the "Hint Mode" option in the puzzle menu: either the program will find the "Simplest" hint or it will find the one which removes the most candidates ("Most Effective"). The simplest hint is the one with the lowest difficulty score. In both cases, if the Exclusion algorithm can operate, it will be given priority (this is because the coding of the other algorithms requires that all Exclusion operations are performed first).

When a hint is requested the program highlights, in red, the candidates which can be deleted and, in green, the reason. For example, in the adjacent Naked Pairs screenshot the 2 and 9 candidates highlighted in red can be deleted because 2 and 9 must be the answers for the squares where they are highlighted in green.

When a hint is requested the wand icon flips to its mirror image. If the player clicks on it while it is in that configuration the program will automatically remove all the candidates highlighted in red, unhighlight those in green, and the wand will revert to its normal orientation. Otherwise the player can delete the red candidates using mouse clicks.

Hint Example

Hint Example

In row 9 there are two squares which contain only 2 different candidates (2,9, shaded green). As they are the only remaining candidates in these squares, they must be their answers. Therefore the other 2,9s in the row (shaded red) can be deleted.

Of course, use of the hint option is not obligatory and purists can work out everything for themselves and simply use the candidate buttons as a notepad for each square.

Checking for Errors

Clicking on the hand button causes the program to check the puzzle for errors (which can occur due to the player removing incorrect candidates). If errors are detected the hand will flip to the thumbs down position. A further click on the hand will reverse all moves made by the player, back to the last time the puzzle was error free. Note that when a hint is requested the program always checks the puzzle for errors first. If errors are detected no hint search will be performed, the hand will flip to thumbs down and the squares with errors will be highlighted.

Difficulty Score

The Difficulty Score is the middle of the three numbers at the top of the games window. Because puzzles can be solved in many different ways, and players may find harder or easier ways than those the program used when it calculated the score, the Difficulty Score can only provide a rough indication of the difficulty. Nevertheless it does give a useful indication of the relative difficulty of puzzles.

Algorithm Score(D)
Hidden Singles 1
Locked 1 2
Locked 2 2
Naked Pairs 3
Naked Triples 3
Hidden Pairs 6
Hidden Triples 6
Naked Quads 6
X-Wing 9
The difficulty scores for the algorithms

The score for a puzzle is calculated as follows. Let Di be the difficulty score for algorithm i, and Ni be the number of squares algorithm i was successfully applied to in solving the puzzle. The difficulty score for the puzzle is then the sum of Ni x Di for all i. During this analysis the program always uses the algorithm with the lowest difficulty score which is effective when applied to the current state of the grid. The algorithms are explained by examples below.

Saving Puzzles

Partially completed puzzles can be saved, with or without the remaining candidates to files so that they can be loaded and worked on at a later time. By default they will be kept in the game's SAVES directory.

Loading Puzzles

Puzzles can be read from files or entered using an interactive Puzzle Editor.

The "Read puzzle" option in the puzzle menu can be used to read grids stored in files. The files must be in one of the formats shown here. Some formats contain clues only, while others can handle clues and candidates and so are suitable for partially completed puzzles. If the file contains more than one puzzle, only the first will be read.

If the puzzle data is found to contain errors the program will automatically load up a Puzzle Entry window to allow the user to make corrections. Although this will enable the puzzle to be entered into the program IT WILL NOT CHANGE THE PUZZLE FILE.

Note that you can make sure that the entered puzzle has only one solution by using the Check puzzle option in the puzzle menu.

Entering Puzzles

The "Enter New Puzzle" option in the puzzle menu can be used to enter puzzles interactively. The puzzles must be in one of the formats shown here. Some formats contain clues only, while others can handle clues and candidates and so are suitable for partially completed puzzles. Unless cutting and pasting into the window it may be difficult to enter some formats correctly. The simplest format is the one shown in the adjacent screenshot and in which unknowns are coded as 0.

Entry Window

Entry Window

Puzzles can be enter and edited using this window.

If the puzzle data is found to contain errors the program will automatically reload up a Puzzle Entry window to allow the user to make corrections.

Note that you can make sure that the entered puzzle has only one solution by using the Check puzzle option in the puzzle menu.

Checking Puzzles

If the player reads a puzzle from a file or enters a puzzle by hand it is possible that the puzzle has more than one solution (all the built-in puzzles have only a single solution). Most would consider puzzles with more than one solution incorrect and obviously the program's ability to monitor mistakes cannot function when this is the case. To cater for the possibility that such a puzzle has been entered the program has an option "Check puzzle" in the File menu which tests the current puzzle to see if it has more than one solution. On some machines this test can take several seconds to complete. While this is happening the puzzle cannot be altered. When it is finished a window will appear reporting the outcome. This window must be closed via its "OK" button before the program can continue.

Algorithms

The algorithms used by Sudoku are explained using examples. In the explanations, rows and columns are numbered from the bottom left hand corner of the grid, starting at 1,1. Candidates highlighted in green are the "reasons" that the candidates highlighted in red can be removed.

Exclusion Rule

Exclusion Rule

The exclusion rule: only one of each digit can occur in any row, column or box, so once an answer is set all other occurrences of that digit in its row, column and box can be deleted. The answer to column 9, row 2 is set to 4, so all others 4s in column 9 can be deleted.

Hidden Single

Hidden Single

Hidden single: all rows, columns and boxes must contain exactly one of each of the digits; if a cell contains the only remaining copy of a digit in a row, column or box, that digit must be the answer for that cell, and any other digits in that cell can be deleted. The square at column 5, row 6 contains the only remaining candidate 4 in row 6. Therefore it must be the answer for this square and all other candidates in the square can be deleted.

Locked Candidate 1

Locked Candidate 1

Locked candidate 1: all rows and columns must contain exactly one of each of the digits; if cells in one row (or column) of one box contain the only copies of digits in that box, those digits must provide the answers for that box, and any occurrences of those digits in the row or column outside the box can be deleted. In the righthand box of row 4 two cells each contain the only 5s and 9s in the box, so must provide the answers for the box (and the row). Therefore the other occurrences of 5 and 9 in the row can be deleted.

Locked Candidate 2

Locked Candidate 2

Locked candidate 2: all rows and columns must contain exactly one of each of the digits; if cells in one row (or column) of one box contain the only copies of digits in that row or column, those digits must provide the answers for that row or column, and any occurrences of those digits in the box outside the row or column can be deleted. In the column 4 the only possibilities for 3 and 8 occur in the bottom box. These must provide the answers for the column (and the box) and so all other 3s and 8s in the box can be deleted.

Hidden Pairs

Hidden Pairs

Hidden pairs: all rows, columns and boxes must contain exactly one of each of the digits; if a pair of cells contain the only copies of two digits in a row, column or box, those digits must be the answers for the two cells, and any other digits in those cells can be deleted. In column 1 only two squares still have candidates 7,8. So 7 or 8 must be the answers to these two squares and the other candidates in those squares can be deleted.

Naked Pairs

Naked Pairs

Naked pairs: all rows, columns and boxes must contain exactly one of each of the digits; if a pair of cells each contain only the same two digits, those digits must be the answers for the two cells, and any other occurrences of those digits in the corresponding row, column or box can be deleted. In row 9 there are two squares which contain only 2 different candidates (2,9, shaded green). As they are the only remaining candidates in these squares, they must be their answers. Therefore the other 2,9s in the row (shaded red) can be deleted.

Hidden Triples

Hidden Triples

Hidden triples: all rows, columns and boxes must contain exactly one of each of the digits; if three cells contain the only copies of three digits in a row, column or box, those digits must be the answers for the three cells, and any other digits in those cells can be deleted. In row 9 only three squares still have candidates 4,7,8. So 4,7 or 8 must be the answers to these three squares and the other candidates in those squares can be deleted.

Naked Triples

Naked Triples

Naked triples: all rows, columns and boxes must contain exactly one of each of the digits; if three cells each contain only the same three digits, those digits must be the answers for the three cells, and any other occurrences of those digits in the corresponding row, column or box can be deleted. In column 1 there are three squares which between them contain only 3 different candidates (2,6,9, shaded green). As they are the only remaining candidates in these squares, they must be their answers. Therefore the other 2,6,9s in the column can be deleted.

Naked Quads

Naked Quads

Naked quads: all rows, columns and boxes must contain exactly one of each of the digits; if four cells each contain only the same four digitis, then those digits must be the answers for the four cells, and any other occurrences of those digits in the corresponding row, column or box can be deleted. In the top left box there are four squares which between them contain only 4 different candidates (1,2,3,4, shaded green). As they are the only remaining candidates in these squares, they must be their answers. Therefore the other 1,2,3,4s in the box can be deleted.

X Wing

X Wing

X wing: all rows and columns must contain exactly one of each of the digits; if cells in two rows (or columns) contain the only copies of one digit in those two rows (or columns) and those four cells form a rectangle, then that digit is the answer for two of those cells, one in each of the intersecting columns (or rows), and other occurrences of that digit in the two columns (or rows) can be deleted. The candidates shaded green are the only 1s in columns 1 and 3. If 1 is the answer for row 6, column 1, then it is also the answer for row 8, column 3. Alternatively, if 1 is the answer for row 8, column 1, then it is also the answer for row 6, column 3. One of these two possibilities has to be the answer for these two columns. Either way, all the 1s in the intersecting rows (shaded red) can be deleted.