Nondeterministic Cellular Automaton
Nondeterministic Cellular Automaton
E.g. specify using a list of rules...
NondeterministicCellularAutomaton[{30,60}]
Implementation
Implementation
In[]:=
NondeterministicCellularAutomaton[rn:{_Integer..}]:=NondeterministicCellularAutomaton[DeleteDuplicates[ReverseSortBy[Flatten[Thread[Tuples[{1,0},3]IntegerDigits[#,2,8]]&/@rn,1],First]]]
In[]:=
NondeterministicCellularAutomaton[{30,60}]
Out[]=
NondeterministicCellularAutomaton[{{1,1,1}0,{1,1,0}0,{1,0,1}1,{1,0,1}0,{1,0,0}1,{0,1,1}1,{0,1,0}1,{0,0,1}1,{0,0,1}0,{0,0,0}0}]
In[]:=
NDCAStep1[rule_,state_List]:=Take[ReplaceList[#,rule]&/@Partition[state,3,1,{-1,1},state],{2,-2}]
In[]:=
NDCAStep0[rule_,state_List]:=Union[Catenate[Tuples[NDCAStep1[rule,#]]&/@state]]
In[]:=
NondeterministicCellularAutomaton[rn_][state_]:=NDCAStep0[rn,state]
In[]:=
NondeterministicCellularAutomaton[rn_,state_,t_]:=With[{ru=NondeterministicCellularAutomaton[rn]},NestList[ru,state,t]]
Running NDCA
Running NDCA
In[]:=
NondeterministicCellularAutomaton[{170,240},{CenterArray[{1},7]},3]
Out[]=
In[]:=
ArrayPlot[Mean/@%]
Out[]=
In[]:=
ArrayPlot[Mean/@NondeterministicCellularAutomaton[{30,60},{CenterArray[{1},41]},20]]
Out[]=
In[]:=
ArrayPlot[Mean/@%]
Out[]=
RulePlot
RulePlot
In[]:=
CellularAutomaton[{{1,1,1}1,{1,1,1}0,{1,1,0}1}]
Out[]=
CellularAutomaton[{{1,1,1}1,{1,1,1}0,{1,1,0}1}]
In[]:=
RulePlot[%]
Out[]=
RulePlot[CellularAutomaton[{{1,1,1}1,{1,1,1}0,{1,1,0}1}]]
In[]:=
RulePlot[CellularAutomaton[{{1,_,1}->0,{1,_,0}->1,{0,_,1}->1,{0,_,0}->0}]]
Out[]=
RulePlot[CellularAutomaton[{{1,_,1}0,{1,_,0}1,{0,_,1}1,{0,_,0}0}]]
Better Implementation
Better Implementation
In[]:=
NDCA[rules_List,states:{__List},t_Integer]:=NestList[Union[Catenate[Function[s,Tuples[Union/@Transpose[Map[#[s]&,CellularAutomaton/@rules]]]]/@#]]&,states,t]
In[]:=
NDCA[{30,60},{{1,0,1,1,0}},3]
Out[]=
In[]:=
NondeterministicCellularAutomaton[{30,60},{{1,0,1,1,0}},3]
Out[]=
CellularAutomaton
In[]:=
Clear[NondeterministicCellularAutomaton]