Sum_Puzzle is a challenging test of logic and simple arithmetic in which the player positions numbers to satisfy six intersecting sums. The starting puzzle presents a grid showing the intersecting sums and their results, but not the numbers used. The player must work out where to place the numbers 1-9, each of which must appear exactly once.
- Unlimited number of games
- Simple interface
- Difficulty setting option
- Read puzzle from file
- Save puzzle to file
- Enter and edit puzzle
- Hint options
- All puzzles have a single solution
- Python source code included
Refering to Figure 1: there are 3 horizontal sums
8 - 3 x 5 = 25
6 - 1 x 7 = 35
4 / 2 - 9 = -7
and 3 vertical sums
8 x 6 + 4 = 52
3 x 1 + 2 = 5
5 + 7 x 9 = 108
It is important to note that arithmetic is performed left to right. For example the middle sum across in Figure 1. is
(6 - 1) x 7 = 35
NOT
6 - (1 x 7) = -1
Analysis of all the possible combinations of pairs of the operators +, -, x and / with the digits 1 to 9 shows that there are 5292 different sums. Of these, 8 are satisfied by only one set of numbers, 98 by 2 sets, 70 by 4 sets, ..., 3 by 48 sets. For example A / B x C = 9 is only satisfied by 6 / 2 x 3 = 9; and A + B x C = 119 is satisfied by 8, 9, 7 and 9, 8, 7; but A + B + C = 16 is satisfied by 48 different sets of numbers.
Obviously the major determinant of the difficulty of solving these puzzles is the number of different sets of numbers which can satisfy each individual sum. The next factor is the particular ways in which the sums intersect: each number is in two sums and hence must satisfy both. Finally, the numbers 1 to 9 must each appear exactly once, and so, as for Sudoku, this can further help to reduce the number of alternatives.
To allow the player to set the difficulty of the puzzles presented the File menu contains an option to select how many sets of numbers satisfy each sum. This value is the average number of sets over the whole puzzle.
Figure 2. shows a screen dump from the beginning of the same game. Here only the operators +, -, x and / and the results are shown. The values that make up the sums are missing and each of their squares contains 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.
Also seen in this figure is the fact that the player has left clicked on the green icon at the end of the first sum. This has brought up a list of the 4 possible sets of numbers which satisfy that sum. The player hence knows that the first number in this sum is 6, 7, 8, or 9, that the second is 1, 2, 3 or 4, and the third is 5. If the player middle clicks on the green icon at the end of a sum the program will remove the candidates which do not appear in these sets. At any stage, if the player thinks she's made a mistake for a sum, she can right click on the icon and all the candidates will be reset. Of course, use of these hint icons is not obligatory and purists can work out everything for themselves and simply use the candidates as a kind of notepad for each square.
The 2 green icons next to the File menu button start a new game (arrow) and show the solution (sad smiley).
If, in response to the player middle clicking on a green icon, the program is automatically removing candidates and finds that only a single candidate remains, it will set that candidate as the number for the square. However, this will not occur if the player is removing candidates by left clicking on them. To set the number for a square the player must middle click on its candidate.
The File menu contains options for reading puzzles from files, saving puzzles to files and for entering puzzles through an on-screen editor. To facilitate this a strict format is used; an example of which is shown in Figure 4.
.+.x.=70 +#x#+ .-9+.=-5 +#x#/ .-.-.=1 14#288#4 Legend . unknown value = separator between sum and total # blank squares to maintain column alignment +-x/ standard arithmetic symbols Here the first line of the file is .+.x.=70 and the last is: 14#288#4 No spaces or additional lines are permitted.
If the program finds any deviation from the format it will give an error message and display the offending line of data, and allow the user to edit the file in an on-screen editor window. An example of which is shown in Figure 6. The puzzle will also be rejected if it has more than one solution.




