Const \$SIZE = 9, \$REGION = Sqrt(\$SIZE) Const \$LENGTH = \$SIZE * \$SIZE Global \$aGrid[\$SIZE][\$SIZE] Global \$aFinalGrid, \$SolutionFound = False Global \$Nx=" 5 7 6 1 5 98 6 6 34 8 3 17 2 6 6 28 19 5 8 79" Global \$N=StringSplit(\$Nx,"",2) Global \$aart[9][9] local \$pointera=0 local \$pointerb=0 for \$pointera= 1 to 9 for \$pointerb= 1 to 9 if " "<>\$N[(\$pointera-1)*9+\$pointerb] Then \$aart[\$pointera-1][\$pointerb-1]=\$N[(\$pointera-1)*9+\$pointerb] next next for \$pointera= 1 to 9 for \$pointerb= 1 to 9 ConsoleWrite(\$aart[\$pointerb-1][\$pointera-1]&" ") next ConsoleWrite(@CRLF) next Solution(\$aart, 1) for \$pointera= 1 to 9 for \$pointerb= 1 to 9 ConsoleWrite(\$aFinalGrid[\$pointerb-1][\$pointera-1]&" ") next ConsoleWrite(@CRLF) next Func Solution(\$aTemp, \$iLoc) ;_ArrayDisplay(\$aTemp) If \$SolutionFound Then Return If \$iLoc > \$LENGTH Then \$SolutionFound = True \$aFinalGrid = \$aTemp Return EndIf Local \$iLine = Int((\$iLoc - 1) / \$SIZE) Local \$iCol = Mod(\$iLoc - 1, \$SIZE) If \$aTemp[\$iLine][\$iCol] Then Solution(\$aTemp, \$iLoc + 1) Else For \$i = 1 To \$SIZE If Possible(\$aTemp, \$iLine, \$iCol, \$i) Then \$aTemp[\$iLine][\$iCol] = \$i Solution(\$aTemp, \$iLoc + 1) EndIf Next EndIf EndFunc ;==>Solution Func Possible(ByRef \$aGrid, \$iLine, \$iCol, \$iValue) For \$i = 0 To \$SIZE - 1 If \$aGrid[\$iLine][\$i] = \$iValue Then Return False If \$aGrid[\$i][\$iCol] = \$iValue Then Return False Next Local \$iRegLine = Int(\$iLine / \$REGION) * \$REGION Local \$iRegCol = Int(\$iCol / \$REGION) * \$REGION For \$line = \$iRegLine To \$iRegLine + \$REGION - 1 For \$col = \$iRegCol To \$iRegCol + \$REGION - 1 If \$aGrid[\$line][\$col] = \$iValue Then Return False Next Next Return True EndFunc ;==>Possible