In[]:=
cfCTQueueHalting=FunctionCompile[Function[{Typed[rules,"ListArray"["PackedArray"["MachineInteger",1]]],Typed[init,"PackedArray"["MachineInteger",1]],Typed[t,"MachineInteger"]},Module[{res=0,q=CreateDataStructure["Queue"]},Scan[q["Push",#]&,init];Do[If[q["Length"]<1,res=tt;Break[],If[q["Pop"]≠0,Scan[q["Push",#]&,rules[[tt-Length[rules]*Quotient[tt-1,Length[rules]]]]]]],{tt,t}];res]]];
In[]:=
cfCTQueueHalting[{{0,1},{0},{0,1,1}},IntegerDigits[15151,2,14],10^8]
Out[]=
0
In[]:=
cfCTQueueHalting[{{0,1},{0},{0,1,1}},IntegerDigits[15151,2,14],10^9]
Out[]=
0
In[]:=
cfCTQueueHalting[{{0,1},{0},{0,1,1}},IntegerDigits[15151,2,14],10^10]
Out[]=
0
In[]:=
cfCTQueuePrunedLengthList=FunctionCompile[Function[{Typed[rules,"ListArray"["PackedArray"["MachineInteger",1]]],Typed[init,"PackedArray"["MachineInteger",1]],Typed[t,"MachineInteger"],Typed[dt,"MachineInteger"]},Module[{q=CreateDataStructure["Queue"],qlen=CreateDataStructure["Queue"]},Scan[q["Push",#]&,init];Do[If[Mod[tt,dt]0,qlen["Push",q["Length"]]];If[q["Length"]≥1,If[q["Pop"]≠0,Scan[q["Push",#]&,rules[[tt-Length[rules]*Quotient[tt-1,Length[rules]]]]]]];q["Length"],{tt,t}];Normal[qlen]]]];
In[]:=
ListLinePlot[cfCTQueuePrunedLengthList[{{0,1},{0},{0,1,1}},IntegerDigits[15151,2,14],10^5,100]]
Out[]=
In[]:=
ListLinePlot[cfCTQueuePrunedLengthList[{{0,1},{0},{0,1,1}},IntegerDigits[7655,2,13],10^5,100]]
Out[]=
In[]:=
ListLinePlot[cfCTQueuePrunedLengthList[{{0,1},{0},{0,1,1}},IntegerDigits[15151,2,14],10^9,10^6]]
Out[]=
In[]:=
cfCTQueuePrunedLengthList[{{0,1},{0},{0,1,1}},IntegerDigits[7655,2,13],10^10,10^6]
Out[]=
In[]:=
ListLinePlot[%]
Out[]=
In[]:=
Now
Out[]=
In[]:=
NotebookSave[]
In[]:=
cfCTQueuePrunedLengthList[{{0,1},{0},{0,1,1}},IntegerDigits[7655,2,13],10^11,10^7]
Out[]=
In[]:=
ListLinePlot[%]
Out[]=
In[]:=
No