void Permute(n)
{
for i = 1 to 9
if B[i]=0 // if i is free
{
B[i]=1
A[n]=i
if (n % 3 = 0) // if n is div by 3
{
if RowSum() = 15
{
if n<9
Permute(n+1)
else // at the end
TestMagic()
}
}
else
Permute(n+1) //recurse
B[i]=0
}
}
Pages
GRAPHICS DESIGN APLLICATION
Subscribe to:
Comments (Atom)