Code covered by the BSD License  

Highlights from
Sudoku

image thumbnail

Sudoku

by

 

14 Oct 2010 (Updated )

Solves 9X9 Sudokus of any difficulty level

[a,test]=mgeta(d,i,j,n)
function [a,test]=mgeta(d,i,j,n)
%to avoid recursion in randsolve
%Part of Project: Sudoku

n1=0;a=[];
        for x=1:9                           %count no of probable elements
            if d(i,x,j)~=0                  
                n1=n1+1;
            end
        end
        
        if n1==n
           for x=1:9
                if d(i,x,j)~=0
                    a=[a x];                %capture probable elements
                end
           end
           test=1;
        else
           test=0;
        end

Contact us