<< sudoku_findhiddensubset Algorithms sudoku_findnakedsubset >>

Sudoku Toolbox >> Algorithms > sudoku_findlocked

sudoku_findlocked

Search for locked candidates.

Calling Sequence

[X,C,L] = sudoku_findlocked ( X , C , L )
[X,C,L] = sudoku_findlocked ( X , C , L , stopatfirst )
[X,C,L] = sudoku_findlocked ( X , C , L , stopatfirst , verbose )

Parameters

X:

a 9-by-9 matrix, with 0 for unknown entries

C:

a cell array of candidate vectors for each cell.

L:

the number of candidates for each cell

stopatfirst:

if %t, then stop after one or more candidates have been removed. (default = %t)

verbose:

a boolean. Set to %t to display the state of the matrix. (default = %f)

Description

Search for locked candidates of types 1 and 2 and eliminates them.

The type 1 algorithm searches in blocks (i.e. minigrids) for each occurence of the numbers n=1,2,...,9. It may happen that one candidate n appears in one single row or column. In this case, the candidate can be eliminated from other blocks in the same row or column. This is often called "Locked Candidate" of type 1 (Pointing).

Locked candidates of type 2 (Claiming) are also searched. The algorithm performs a loop for n=1,2,...,9 and for each row i. If there are cells which contains n as a candidate and are in one single block, we remove n from the candidates of the other cells in the same block. We also search for locked candidates of type 2 in columns.

Examples

X = [
1 0 8   6 7 2   0 9 3
0 0 9   8 1 4   6 0 2
0 6 0   9 5 3   8 0 1
..
0 0 6   0 0 7   1 8 0
0 2 1   0 9 8   7 3 6
0 8 0   1 0 6   0 0 0
..
0 1 4   3 8 9   0 6 7
6 0 0   0 4 1   9 0 8
8 9 0   0 6 5   3 1 4
]
[C,L] = sudoku_candidates(X)
// The digit 2 is eliminated as candidate in (6,5).
[X,C,L] = sudoku_findlocked ( X , C , L , %f , %t )

Authors

Bibliography

The mathematics of Sudoku, Tom Davis, 2008

http://hodoku.sourceforge.net/en/tech_intersections.php#lc1

<< sudoku_findhiddensubset Algorithms sudoku_findnakedsubset >>