<< sudoku_candidatescell Algorithms sudoku_cellcandidates >>

Sudoku Toolbox >> Algorithms > sudoku_candidatesmerge

sudoku_candidatesmerge

Merge candidates in the row, column or block.

Calling Sequence

carray = sudoku_candidatesmerge ( X , C , L , kind , i , j , len )

Parameters

X:

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

C:

a 9 x 9 cell of candidates

L:

the 9 x 9 matrix of number candidates

kind:

set kind=1 for row, kind=2 for column and kind=3 for block

i:

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

j:

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

len:

an array of two reals

len(1):

minimum number of candidates in the cell.

len(2):

maximum number of candidates in the cell.

carray:

a row vector containing all the unique candidates in the row, column or block.

Description

Merge all candidates in a row, column or block and returns them. Only cells which number of candidates is between lenmin and lenmax are taken into account. Returns only unique candidates: duplicate candidates are removed. If there is no candidate in this row, column or block, returns an empty matrix. The merged candidates are returned as a row matrix.

Examples

X = [
4 0 0   3 9 0   0 0 2
2 6 0   0 5 8   3 9 0
5 9 3   6 0 0   1 8 0
..
1 0 0   8 6 0   0 0 9
6 0 5   9 0 0   2 0 0
0 3 9   2 4 5   0 1 6
..
0 5 6   0 0 9   0 2 0
0 1 4   7 0 0   9 0 5
9 0 0   5 3 0   0 0 0
];
[C,L] = sudoku_candidates(X);
sudoku_candidatesmerge ( X , C , L , 1 , 2 , [] ); // Merge all candidates from row 2

Authors

<< sudoku_candidatescell Algorithms sudoku_cellcandidates >>