Triangular Automata
Triangular Automata
Mathematica Package
This notebook aims to show the functionalities of the Triangular Automata package. This second version of the package is much more efficient but lacks some v1 features. I will add them back gradually.
More information: https://triangular-automata.net
More information: https://triangular-automata.net
Setup
Setup
First, run the following command to import the package.
In[]:=
<<"https://code.triangular-automata.net/TriangularAutomata.wl";
Grid
Grid
In this package, grids have the header TAGrid. There are a few predefined grids that you can use.
In[]:=
{TAGrid[1],TAGrid[0],TAGrid["Hexagon"],TAGrid["TA"]}
Out[]=
,
,
,
TANegative[grid] returns the negative grid.
In[]:=
TANegative@TAGrid["TA"]
Out[]=
You can also define your own grid by using a matrix.
TAGrid[{{1,1},{1,1},{1,1}}]
Out[]=
The second argument of TAGrid is the state of the universe.
In[]:=
TAGrid[{{0,0},{0,0},{0,0}},1,0]
Out[]=
The third is the phase of the top-left triangle: 0 if it points to the left, 1 if it points to the right.
In[]:=
TAGrid[{{0,0},{0,0},{0,0}},1,1]
Out[]=
You can generate random x-by-y grids with TARandom[{x,y}].
In[]:=
TARandom[{12,8}]
Out[]=
The optional parameters are, the density, the state of the universe and the phase of the grid.
In[]:=
TARandom[{12,8},.9,1,1]
Out[]=
The function TAEdit[grid] opens a pop-up window to edit the grid.
In[]:=
TAEdit@TARandom[{6,6},0]
Out[]=
Evolution
Evolution
The function TAEvolve serves to apply a rule to a grid.
In[]:=
TAEvolve[TAGrid[1],181]
Out[]=
The third argument indicates the number of times the rule should be applied.
In[]:=
TAEvolve[TAGrid[1],181,32]
Out[]=
If you place it in curly brackets, the function returns the list of grids.
In[]:=
TAEvolve[TAGrid[1],181,{8}]
Out[]=
,
,
,
,
,
,
,
,
If you give a list of rule numbers, the rules will alternate.
In[]:=
TAEvolve
,{88,150},512
Out[]=
Plots
Plots
To plot a grid, use the function TAPlot.
In[]:=
TAPlot@
If the grid is very large, you can use TAQuickPlot to render the grid much more efficiently at the expense of details.
You can also make plot for rules using TARulePlot[rule].
Utilities
Utilities
TAPopulation[grid] will return the number of cells in the grid that have the opposite state to the universe.
TADestroboscopify[rule] will return the rules to alternate to obtain a similar behavior as the rule be without the stroboscopic effect.