## Introduction

Futoshiki is a challenging logic game in which players use a combination of methods to solve a Latin square. Please refer to Figure 1. At the start of a game the program presents a 5x5 grid of squares. Most of these squares will be empty except for tiny candidate numbers along their top edges, but generally a few squares will already have their answers filled in. Between some pairs of squares the inequality symbols < and > are displayed to indicate the relative sizes of their answers. To solve the puzzle players must place each of the digits 1 - 5 exactly once in every row and column so that they are consistent with the given inequality symbols.

Figure 1. is a screen dump from Futoshiki_SG. The large digits are the current answers and the small digits are the remaining candidate answers for the individual squares. The inequality symbols < and > indicate the relative value of the answers to adjacent squares. The player has asked for a hint and the program is indicating that the two candidates labelled in red can be deleted (see Algorithms for an explanation.)

### Features

• Unlimited number of games
• Choice of grid size
• Hint option
• Simple interface
• Difficulty scores shown
• Python source code included

### Grid size

All the descriptions here assume a grid size of 5x5, which is the default. However the File menu contains an option which will allow the player to set the size up to a maximum of 9. Be aware that the program does not store the grids, but generates them on request, and larger grids take longer to make. The File menu also contains a Help option which covers all the "How to" information contained in these web pages.

Figure 3. A screen dump from Futoshiki_SG showing a grid size of 9 [click for larger image].

## Playing Futoshiki_SG

Please refer to Figures 1 and 2 and note that rows and columns are numbered from the bottom left hand corner of the grid, starting at 1,1. Each of the squares which have yet to be given a value contain tiny "candidate" numbers 1-5. 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.

Figure 2. is a screen dump from Futoshiki_SG showing use of the Naked Pair algorithm. In row 2 there are two squares which contain only 2 different candidates (3,4, shaded green). As they are the only remaining candidates in these squares, they must be their answers. Therefore the other 3,4s in the row can be deleted.

At the top of the display is a toolbar of green buttons. The arrow starts a new game; the wand requests a hint; the hand asks that the puzzle be checked for errors; clicking on the sad smiley results in the solution being displayed. The number at the right hand end of the toolbar is the Difficulty Score.

### Using Hints

When a hint is requested the program highlights, in red, the candidates which can be deleted and, in green, the reason. For example, in Figure 1. the 1 and 2 candidates highlighted in red can be deleted because they are ≤ the candidate 2 highlighted in green; ie they contradict the symbol between the two squares which indicates that the answer for that square is > than the one above. 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 and the wand will revert to its normal orientation.

The hint shown is always the one which will remove the maximum number of candidates, unless the Exclusion algorithm can operate, in which case it will be given priority (this is because the coding of the other algorithms requires that all Exclusion operations are performed first). 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 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 and the hand will flip to thumbs down.

### Difficulty Score

The Difficulty Score is written at the top right of the game 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.

```                       D
Relative Values   1
Hidden Single     2
Naked pair        4
Naked Triple      5
Hidden Pair       7
Hidden Triple     8
X Wing            9
```
Table 1 The difficulty scores for the algorithms used by Futoshiki_SG.

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 total for the puzzle is then the sum of Ni x Di for all i. The Difficulty Score is the difficulty total divided by the number of squares in the grid (to make the score independent of the grid size). 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 outlined on a separate page.