function [row,col,boc] = uniquelize_sudoku(candi)
% Function: uniquelize_sudoku
% used for getting information for further logical calculation
%
% Input: candi = 9x9 cell (candidats cell)
% whose elements are possible numbers for its corresponding grid
% For example:
% candi = {[2,4,5,8],[2,4,5,9],[2,4,5,8],3,[2,6,8,9],1,7,[4,6],[4,6,8];
% 1,[3,5,9],[3,5,7,8],[5,6,7,8,9],4,[8,9],[3,6,8,9],2,[3,6,8];
% [2,3,4,7,8],6,[2,3,4,7,8],[7,8,9],[2,7,8,9],[2,8,9],[3,8,9],5,[1,3,4,8];
% 9,[1,2,3],[1,2,3,7,8],4,[1,3,7,8],5,[2,3,6],[3,6,7],[3,6,7];
% [2,3,4,5,7,8],[2,3,4,5],6,[7,8,9],[3,7,8,9],[3,8,9],1,[3,4,7],[3,4,5,7];
% [3,4,5,7],[1,3,4,5],[1,3,4,5,7],2,[1,3,7],6,[3,5],8,9;
% [2,3,5,6],7,[1,2,3,5],[1,6,8],[1,2,3,6,8],[2,3,8],4,9,[1,3,5,6,8];
% [3,4,6],8,[1,3,4],[1,6,9],5,[3,4,9],[3,6],[1,3,6,7],2;
% [2,3,4,5,6],[1,2,3,4,5],9,[1,6,8],[1,2,3,6,8],7,[3,5,6,8],[1,3,6],[1,3,5,6,8];}
%
% Output: row = 9x1 cell each of which contains the numbers shown in
% corresponding candidats cell
% col = 1x9 cell each of which contains the numbers shown in
% corresponding candidats cell
% boc = 3x3 cell each of which contains the numbers shown in
% corresponding candidats cell
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% This is a sub-function of the sub-function sudoku_grid_candidates
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% All copyrights reserved
% By Yue Wu
% 10/05/2009
% ECE Dept, Tufts Univ.
% MA, Medford 02155
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% 1. initialization
siz = size(candi);
row = cell(9,1);
col = cell(1,9);
boc = cell(3,3);
bocmap = [1 1 1 2 2 2 3 3 3];
%% 2. retrieve information along row, col and boc
for i = 1:siz
for j = 1:siz
clear tmp
tmp = candi{i,j};
row{i} = [row{i},tmp];
col{j} = [col{j},tmp];
bocx = bocmap(i);
bocy = bocmap(j);
boc{bocx,bocy} = [boc{bocx,bocy},tmp];
end
end