<<MultiwaySystems`Multiway`
<<"Universe-97/TimeNetworks.m"
MWEvolve[rule_,init_,t_]:=Nest[MWStep[rule,#]&,init,t]
MWEvolveSS[rule_,init_,t_,max_:300]:=Catch[Nest[If[Length[#]>max,Throw[#],MWStep[rule,#]]&,init,t]]
MWEvolveSS[{"B""ABBA","A""BBBA"},{"BABBA"},8,50];
Length[%]
789
Table[RandomSMW[3,4],{20}]
{{BABBAAAA,ABAAA,ABAAB},{ABBBB,AABAA,ABB},{ABBA,ABBAABA,ABB},{ABAB,BAA,AAABBB},{AABBB,BAABAAAB,ABAABABA},{ABBAB,ABAABB,BBBBABB},{BBBBAABA,BBAAAABA,BBABB},{ABBB,BAB,AABA},{AAAA,AAB,BBBB},{BBAABA,ABBBA,ABAABBB},{BBBAABA,AABAB,BAB},{ABAAABAB,AABB,AAABB},{BAAAA,BBBAA,BBAABBAA},{AB,BBBBA,AAB},{BBBABA,ABB,ABABABAB},{BBB,AAABBB,BAB},{BAA,BAB,BAAAA},{ABAAAA,AAABAA,BAAA},{BAAAABA,BBA,ABBA},{BAABA,ABB,AAABA}}
MapIndexed[Catch[Show[LabelWrapper[RPadGraphics[Sort[FromChars/@If[Length[#]<1,Throw[{}],#]&@MWEvolveSS[#1,{"BABBA"},8,40]]],BigFont[#2]]]]&,%];
{{2,
MWEvolveTest[rule_,init_,t_,max_:300]:=Nest[Function[a,If[Length[a]>max,Throw[False],If[#===a,Throw[False],#]&@MWStep[rule,a]]],init,t]
InterfaceAverage[str_]:=Apply[Plus,Length[StringPosition[#,{"AB","BA"}]]/StringLength[#]&/@str]/Length[str]
GrowthTest[rule_,init_]:=TimeConstrained[If[#===False||Length[#]<10||!(.15<InterfaceAverage[#]<.9),False,Length[Union[MWEvolveList[rule,#,4]]]5]&@Catch[Fold[MWEvolveTest[rule,#1,#2[[1]],#2[[2]]]&,init,{{2,5},{3,10},{5,30},{10,200},{10,500}}]],.2,False]
Select[Table[RandomSMW[3,4],{20}],GrowthTest[#,{"ABBA"}]&]
{{BBBBBAB,BAB,AABB},{BBABB,BBABBA,BBAA},{ABAABBB,BBAB,BAAAA}}
GrowthTest[{"ABA""ABBB","BB""AB","BAAA""A"},{"ABBA"}]
False
Length/@MWEvolveList[{"ABA""ABBB","BB""AB","BAAA""A"},{"ABBA"},20]
{1,1,1,2,2,3,4,5,7,9,13,16,23,30,40,53,70,93,123,164,216}
Select[Table[RandomSMW[3,4],{20}],GrowthTest[#,{"ABBAB"}]&]
{{ABAB,BBABBBA,BAA}}
Show[RPadGraphics[Sort[FromChars/@MWEvolve[#,{"ABBAB"},20]]]]&/@%;
Select[Table[RandomSMW[3,4],{100}],GrowthTest[#,{"ABBAB"}]&]
{{BBBBBA,BB,BBBBA},{ABBBBAA,BBBBAB,BBBB},{BBAB,AAB,AABABBB}}
Show[RPadGraphics[Sort[FromChars/@MWEvolve[#,{"ABBAB"},20]]]]&/@%;
Select[Table[RandomSMW[3,4],{100}],GrowthTest[#,{"ABBAB"}]&]
{{AAAA,BBAAAB,ABBABBA}}
Show[RPadGraphics[Sort[FromChars/@MWEvolve[#,{"ABBAB"},20]]]]&/@%;
Show[RPadGraphics[Sort[FromChars/@MWEvolve[#,{"ABBAB"},30]]]]&/@%107;
Select[Table[RandomSMW[3,4],{20000}],GrowthTest[#,{"ABBAB"}]&]
MapIndexed[Show[LabelWrapper[RPadGraphics[Sort[FromChars/@MWEvolve[#,{"ABBAB"},20]]],BigFont[#2]]]&,%];