In[]:=
SubstitutionSystem["A"->"AA","A",4]
Out[]=
{A,AA,AAAA,AAAAAAAA,AAAAAAAAAAAAAAAA}
In[]:=
ArrayPlot[CellularAutomaton[90,{{1,1,1,0,1},0},20],Mesh->True]
Out[]=
In[]:=
ArrayPlot[CellularAutomaton[90,{{1,1,1,1,0,1},0},20],Mesh->True]
Out[]=
Some range of input strings replicate; others don’t.
Size 16 inputs. Rule with k=2, r=2. Over the course of T steps, what is the minimum value of the loss.
{0...,1,1,1,0,1,0...,1,1,1,0,1,0...}
In[]:=
EditDistance[{1,1,1,0,1},{1,0,1,1}]
Out[]=
2
{0...,i,0...,i,0...}
{1,1,1,0,1,0,0,0,0,1,1,1,0,1}
In[]:=
Module​​{deep=5000,cut=200,ru,life,evo,data},​​SeedRandom[426778];​​evo=NestListCompoundExpression​​ru=
[◼]
RandomRuleMutation
[First[#]],​​life=
[◼]
TestLifetime
[ru,cut],​​If[life>=Last[#],{ru,life},#]​​&,{{0,3,1},0},deep;​​evo=Rest[First/@SplitBy[evo,Last]];​​MapCompoundExpression​​data=CellularAutomaton[​​First[#],{{1},0},Last[#]+2],​​data=ArrayPad[#,2]&/@data,​​ArrayPlotdata,ColorRules->
[◼]
CustomStyleData
["Colors"],​​ImageSize->{Automatic,26Sqrt[Length[data]+1]},​​Mesh->True,MeshStyle->Opacity[.1]​​​​&,​​evo​​
In[]:=
[◼]
RandomRuleMutation
[{55,2,2}]
Out[]=
{4151,2,2}
{rule,loss}
​
In[]:=
reploss[orig_,current_]:=EditDistance[orig,ResourceFunction["ArrayCrop"][current]]
In[]:=
reploss[{1,1,0,1},{0,0,0,1,1,0,1,0,0,0}]
Out[]=
0
In[]:=
Module{loss,ru},NestListru=
[◼]
RandomRuleMutation
[First[#]];loss=Min[reploss[{1,1,1,0,1,0,0,0,0,1,1,1,0,1},#]&/@CellularAutomaton[ru,{{1,1,1,0,1},0},40]];If[loss<=Last[#],{ru,loss},#]&,{{0,2,2},Infinity},100
Out[]=
{{{0,2,2},∞},{{32768,2,2},9},{{40960,2,2},9},{{33595392,2,2},9},{{33595456,2,2},9},{{33595460,2,2},9},{{33562692,2,2},9},{{33563716,2,2},9},{{33565764,2,2},9},{{33582148,2,2},9},{{33582084,2,2},9},{{33582086,2,2},9},{{33582342,2,2},4},{{34630918,2,2},4},{{34635014,2,2},3},{{36732166,2,2},3},{{36732198,2,2},3},{{1110474022,2,2},3},{{1110474022,2,2},3},{{1110474022,2,2},3},{{1110474022,2,2},3},{{1110474086,2,2},3},{{1110474022,2,2},3},{{1378909478,2,2},3},{{1378909478,2,2},3},{{1383103782,2,2},3},{{1383136550,2,2},3},{{1383202086,2,2},3},{{1383202086,2,2},3},{{1383169318,2,2},3},{{1383169318,2,2},3},{{1383161126,2,2},3},{{1349606694,2,2},3},{{1347509542,2,2},3},{{1349606694,2,2},3},{{1366383910,2,2},3},{{1366379814,2,2},3},{{1362185510,2,2},3},{{1899056422,2,2},3},{{1882279206,2,2},3},{{4029762854,2,2},3},{{4029766950,2,2},3},{{4029766950,2,2},3},{{3492896038,2,2},3},{{3492830502,2,2},3},{{3492828454,2,2},3},{{3559937318,2,2},3},{{3559937318,2,2},3},{{3291501862,2,2},3},{{3292026150,2,2},3},{{3325580582,2,2},3},{{3329774886,2,2},3},{{3296220454,2,2},3},{{3329774886,2,2},3},{{3329783078,2,2},3},{{3329785126,2,2},3},{{3329781030,2,2},3},{{3329781030,2,2},3},{{3329780006,2,2},3},{{3325585702,2,2},3},{{3325585702,2,2},3},{{3329780006,2,2},3},{{3329780006,2,2},3},{{3329780006,2,2},3},{{1182296358,2,2},3},{{1182300454,2,2},3},{{1148746022,2,2},3},{{1148746038,2,2},3},{{1685616950,2,2},2},{{1685617014,2,2},2},{{1685617014,2,2},2},{{1685617014,2,2},2},{{1719171446,2,2},2},{{1719171446,2,2},2},{{1719171414,2,2},2},{{1719236950,2,2},2},{{1719236950,2,2},2},{{1719236886,2,2},2},{{1719236886,2,2},2},{{1719236886,2,2},2},{{1719234838,2,2},2},{{1987670294,2,2},1},{{1987662102,2,2},1},{{1987662102,2,2},1},{{1987924246,2,2},1},{{2004701462,2,2},1},{{2004439318,2,2},1},{{2004701462,2,2},1},{{1971147030,2,2},1},{{1971148054,2,2},1},{{1971143958,2,2},1},{{1971143958,2,2},1},{{1971152150,2,2},1},{{1971152150,2,2},1},{{1979540758,2,2},1},{{1977443606,2,2},1},{{2111661334,2,2},1},{{2111653142,2,2},1},{{2111653142,2,2},1},{{2111653142,2,2},1},{{2111661334,2,2},1}}
In[]:=
Labeled[ArrayPlot[CellularAutomaton[First[#],{{1,1,1,0,1},0},40]],Last[#]]&/@First/@SplitBy[%27,Last]
Out[]=

∞
,
9
,
4
,
3
,
2
,
1


Take a rule, and see the largest init it can reproduce....

Find minimum “reproduction loss” + maximum initial length