Contents

# Goal

The intent of the program is to mimic the way a person solves a Sudoku problem

# Algorithms

Only 4 algorithms are used (5 for Killer) plus a routine to record the solutions. These are called:

- Only one possible location in a Shape
- Only 1 possibility in a Cell
- N possible solutions in N Cells in a Shape
- Intersection of Overlapping Shapes
- Check Partitions (Killer only)
- Record Solutions

## #1. Only one possible location in a Shape

Checks all possibilities in all Cells in a given Sudoku Shape. If there is a possibility that is only possible in one Cell then it must be a solution for that Cell. It will be flagged for recording as a solution. This simulates the normal approach to solving Sudoku problems by hand.

Note this will only work for Sudoku Shapes, not for Killer Shapes.

## #2. Only 1 possibility in a Cell

Checks in each Cell to see how many possibilities remain. If only one then that must be a solution. Flags this for recording as a solution. This is the hard work approach of crossing out all possibilities if solving a Sudoku by hand.

## #3. N possible solutions in N Cells in a Shape

Checks in each Shape for groups of 2 Cells each with the same 2 possibilities. These possibilities can be removed from all other Cells in this Shape. Then repeats for groups of 3, 4,… Cells containing the same 3, 4,… possibilities.

This works for both Sudoku and Killer Shapes.

## #4. Intersection of Overlapping Shapes

Check Cells which are in the intersection of 2 Shapes. If there are any possibilities which occur in the intersection but nowhere else in one of the Shapes then these possibilities can also be removed from all Cells in the second Shape except those in the intersection.

As long as the first Shape is a Sudoku Shape the second can be either a Sudoku or a Killer Shape.

## #5. Check Partitions (Killer only)

Once the solution has started the number of possibilities will reduce in some of the Cells. This algorithm works Killer Cell by killer Cell to check that the remaining possibilities can still add to the sum and eliminate possibilities which cannot.

This is not necessary for Sudoku Shapes where simply recording a solution and removing this possibility from all other Cells in the Shape effectively accomplishes the same objective.

## #6. Record Solutions

Algorithms 1 and 2, above, flag Cells as solutions. This routine actually records the solution. The Cell is marked as Solved and the Solution Value is removed as a possibility from all other Cells in all Shapes containing this Cell.