Find a candidate in the sudoku.
[rows,cols] = sudoku_candidatefind ( X , C , L , d )
a 9-by-9 matrix, with 0 for unknown entries
a 9 x 9 cell of candidates
the 9 x 9 matrix of number candidates
the digit to find in the sudoku
the rows where the candidate is found
the columns where the candidate is found
Search for the candidate d in all the nonfixed cells of the sudoku X. The number of cells where d is a candidate is size(rows,"*") = size(cols,"*"). The loop of the the nonfixed cells which contain d as a candidate is made by for k = 1 : size(rows,"*") then with r = rows(k) and c = cols(k).
The search is performed column by column, which implies the ordering of the result: the cols array is sorted in increasing order.