all tasks
This commit is contained in:
parent
b83f433714
commit
68f8f3e56b
14735 changed files with 178959 additions and 0 deletions
13
Task/Sudoku/Mathematica/sudoku-1.math
Normal file
13
Task/Sudoku/Mathematica/sudoku-1.math
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
solve[array_] :=
|
||||
NestWhile[
|
||||
Join @@ Function[newarray,
|
||||
Function[{i, j},
|
||||
Table[ReplacePart[newarray,
|
||||
Position[newarray, 0, {2}, 1][[1]] -> n], {n,
|
||||
Select[Range@9,
|
||||
FreeQ[newarray[[i]], #] && FreeQ[newarray[[All, j]], #] &&
|
||||
FreeQ[Partition[
|
||||
newarray, {3, 3}][[Sequence @@
|
||||
Quotient[{i, j}, 3, -2]]], #] &]}]] @@
|
||||
Position[newarray, 0, {2}, 1][[1]]] /@ # &, {array}, !
|
||||
FreeQ[#, 0] &]
|
||||
9
Task/Sudoku/Mathematica/sudoku-2.math
Normal file
9
Task/Sudoku/Mathematica/sudoku-2.math
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
solve[{{9, 7, 0, 3, 0, 0, 0, 6, 0},
|
||||
{0, 6, 0, 7, 5, 0, 0, 0, 0},
|
||||
{0, 0, 0, 0, 0, 8, 0, 5, 0},
|
||||
{0, 0, 0, 0, 0, 0, 6, 7, 0},
|
||||
{0, 0, 0, 0, 3, 0, 0, 0, 0},
|
||||
{0, 5, 3, 9, 0, 0, 2, 0, 0},
|
||||
{7, 0, 0, 0, 2, 5, 0, 0, 0},
|
||||
{0, 0, 2, 0, 1, 0, 0, 0, 8},
|
||||
{0, 4, 0, 0, 0, 7, 3, 0, 0}}]
|
||||
Loading…
Add table
Add a link
Reference in a new issue