Kakuro: Solving techniques 1

Previous page Next page

Hint algorithms

When I started this project I was not aware of standard Kakuro solving methods such as exist for Sudoku so the hints available in SourGumdropK are mostly the ones that have occurred to me while developing the program. If the program got stuck solving a puzzle from the Guardian I worked out a way to make progress and then coded that as a standard algorithm used by the hint mechanism. Of course some of the standard Sudoku methods do apply here and have been retained - or rather, recoded, because the flexibility in grid shape can make it difficulty to know where some algorithms can be applied. Think of XWing - in a Sudoku grid the connections between rows and columns are fixed; in Kakuro the program has to work out which cells are eligible to be searched for an XWing.

Terminology

The starting grid shows the sums down and sums across and the cells to be solved. Set the digits 1-9 in the cells to be solved so that they add up to the sums across and down. Each digit can only be used once per strip. A strip is a set of adjacent cells - across or down - preceeded by a sum cell and terminated by a blank cell or a sum cell. A sum cell is one containing the required sum for the cells to its right or the cells below. A solve cell, or cell to be solved, is one requiring a solution. A blank cell functions only as padding to give the required shape to the overall grid. The cell count is the number of cells in a strip. A solving combination is a subset of the digits 1-9 in any order which sum to the required total for a strip. Typically there will be several such combinations for each strip - i.e. for each sum and cell count. A permutation is a particular ordering of the digits in a combination. For example, the sum 12 and cell count 4 is satisfied by two combinations: [1,2,3,6] and [1,2,4,5]. If the first of these combinations is the solving combination, there are 4! = 24 possible permutations: [1,2,3,6], [1,3,2,6],..., [6,3,2,1].

Simple filter SF

The simple filter method contains two separate algorithms. First, if none of the possible combinations for a strip contain a particular candidate, that candidate can be removed from all cells in the strip. See Figure 1.

SourGumdropK: simple filter example
Figure 1. The sum across, 23, has the single combination [6,8,9] so all other candidates can be removed from cells in the row [click for larger image].

Second, if a candidate is set as the solution for a cell, it can be removed from all other cells in the strip. See Figure 2.

SourGumdropK: simple filter example
Figure 2. The candidate, 2, is already used in the row, so can be deleted from all its other cells [click for larger image].

Simple filter exhaustively S

This method repeatedly applies the two algorithms of Simple filter until no futher candidates can be deleted. It is automatically applied before any of the other algorithms (except Simple filter when explicitly selected from the Toolbar).

Last updated: 2012-10-28    Sitemap