<< sudoku_candidateprint Algorithms sudoku_candidates >>

Sudoku Toolbox >> Algorithms > sudoku_candidateremove

sudoku_candidateremove

Remove a candidate.

Calling Sequence

C = sudoku_candidateremove ( C , kind , iv , jv , v )

Parameters

C:

a 9 x 9 cell of candidates

L:

the 9 x 9 matrix of number candidates

kind:

set to 1 for row, 2 for column and 3 for block, 4 for cell

iv:

the row of the value. If kind = 1 or 4, iv in 1:9. If kind = 3, iv in [1 4 7].

jv:

the column of the value. If kind = 2 or 4, jv in 1:9. If kind = 3, jv in [1 4 7].

v:

the value to remove

Description

Removes the value v from the candidates in C. Removes v from the row, column or block identified by ix and jx. If kind = 1, we remove v from the row iv. If kind = 2, we remove v from the column jv. If kind = 3, we remove v from the block (iv,jv). If kind = 4, we remove v from the cell (iv,jv).

Examples

X = [
0 6 0   0 9 0   0 0 0
0 0 3   1 0 0   0 9 0
1 9 0   0 2 6   3 0 0
..
8 0 0   5 0 0   4 1 0
0 0 0   0 6 0   0 0 0
0 5 1   0 0 3   0 0 9
..
0 0 9   6 3 0   0 2 7
0 2 0   0 0 4   5 0 0
0 0 0   0 1 0   0 4 0
];
[C,L] = sudoku_candidates ( X )
[ C , L ] = sudoku_candidateremove ( C , L , 4 , 2 , 2 , 7 ) // Remove the 1 from the cell (7,7) : it is a row locked candidate of type 1

See also

Authors


<< sudoku_candidateprint Algorithms sudoku_candidates >>