sudokuSolve[mat_] := Module[
{toX, count, symMat, cond, iter, res},
toX = Symbol["x" <> IntegerString[#, 10, 2]] &;
count = 1;
symMat = Partition[
If[# == 0, toX[count++], #] & /@ Flatten[mat],
9];
cond = And @@ Unequal @@@ Join[
symMat,
Transpose[symMat],
Join @@@ Join @@ Partition[symMat, {3, 3}]
];
cond = LogicalExpand[cond];
iter = Table[{
toX[i + 1],
If[Or @@ Cases[Equal @@@ cond, toX[i] == _],
0,
Evaluate@If[i < count - 1, 9, 1]]},
{i, 0, count - 1}];
res = Reap[Compile[{}, Do[Sow[#], ##2]] &[symMat, Sequence @@ iter][]];
res[[2, 1]]
]
searching for the sudokuSolve code