Update all new Tasks
This commit is contained in:
parent
00a190b0a6
commit
91df62d461
5697 changed files with 93386 additions and 804 deletions
|
|
@ -0,0 +1,38 @@
|
|||
nB[mat_] := Delete[mat // Flatten, 5] // Total;
|
||||
|
||||
nA[mat_] := Module[{l},
|
||||
l = Flatten[mat][[{2, 3, 6, 9, 8, 7, 4, 1, 2}]];
|
||||
Total[Map[If[#[[1]] == 0 && #[[2]] == 1, 1, 0] &,
|
||||
Partition[l, 2, 1]]]
|
||||
];
|
||||
|
||||
iW1[mat_] :=
|
||||
Module[{l = Flatten[mat]},
|
||||
If[Apply[Times, l[[{2, 6, 8}]]] + Apply[Times, l[[{4, 6, 8}]]] ==
|
||||
0, 0, 1]];
|
||||
iW2[mat_] :=
|
||||
Module[{l = Flatten[mat]},
|
||||
If[Apply[Times, l[[{2, 6, 4}]]] + Apply[Times, l[[{4, 2, 8}]]] ==
|
||||
0, 0, 1]];
|
||||
|
||||
check[i_, j_, dat_, t_] := Module[{mat, d = Dimensions[dat], r, c},
|
||||
r = d[[1]];
|
||||
c = d[[2]];
|
||||
If[i > 1 && i < r && j > 1 && j < c,
|
||||
mat = dat[[i - 1 ;; i + 1, j - 1 ;; j + 1]];
|
||||
If[dat[[i, j]] == 1 && nA[mat] == 1 && 2 <= nB[mat] <= 6 &&
|
||||
If[t == 1, iW1[mat], iW2[mat]] == 0, 0, dat[[i, j]]],
|
||||
dat[[i, j]]
|
||||
]];
|
||||
|
||||
iter[dat_] :=
|
||||
Module[{i =
|
||||
Flatten[Outer[List, Range[Dimensions[dat][[1]]],
|
||||
Range[Dimensions[dat][[2]]]], 1], tmp},
|
||||
tmp = Partition[check[#[[1]], #[[2]], dat, 1] & /@ i,
|
||||
Dimensions[dat][[2]]];
|
||||
Partition[check[#[[1]], #[[2]], tmp, 2] & /@ i,
|
||||
Dimensions[tmp][[2]]]];
|
||||
|
||||
|
||||
FixedPoint[iter, dat]
|
||||
Loading…
Add table
Add a link
Reference in a new issue