0
$\begingroup$

I need help. I want to create a 3D version of the rule 90 cellular automaton, but I don't know how to do it. Please help me. It is for a class in the theory of chaos.

enter image description here

this is my code

Autom90[lst_, t_] :=
  Module[{MR1, MR2, up2, up},
    MR1[ls_] := RotateRight[ls, 1];
    MR2[ls_] := RotateRight[ls, -1];
    up2[0, 0, 1] := 1;
    up2[0, 1, 1] := 1;
    up2[1, 0, 0] := 1;
    up2[1, 1, 0] := 1;
    up2[_, _, _] := 0;
    Attributes[up2] = Listable;
    up[ls_] := up2[MR1[ls], ls, MR2[ls]];
    NestList[up, lst, t]]

au = 
  Autom90[{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, 50]

Clear[delt, n, cel, cel2];
n := 100;
t := 100;
delt[1, n + 1] := 1;
delt[1, _] := 0;
lista := Table[delt[1, i], {i, 2 n + 1}];
au = Autom90[lista, t];
cel[i_, j_] := au[[i, j]];
cel2 := Table[cel[i, j], {i, t}, {j, 2*n + 1}];
ArrayPlot[cel2, ColorRules -> {1 -> Red, 0 -> Green}]
$\endgroup$
  • $\begingroup$ Is there nothing in the functionality of the CellularAutomaton function that can help you? $\endgroup$ – MarcoB Jun 4 '18 at 23:06
  • $\begingroup$ I have to use this code for do it in 3D :( $\endgroup$ – Carlos Francisco Flores Paez Jun 5 '18 at 17:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.