Details
Possible forms for rule are:
{in1→out1,in2→out2,…} | a list of rules |
Dispatch[{in1→out1,…}] | an optimized list of rules |
Association[in1→out1,…] | a lookup dictionary |
{rule, dim} | with rule any of the above, and dim equals block length |
Specification by
Association may lead to the fastest calculations, but it requires a comprehensive list of inputs without any usage of pattern matching or
RuleDelayed. Lists of rules may lead to slightly slower calculations, but are more flexible by allowing for pattern matching. The
Dispatch usage should not be much slower than the
Association usage.
ResourceFunction["BlockCellularAutomaton"] allows one extra rule specification {rule,{2,2}} for evolutions through two spatial dimensions, which alternate between phase values 0 and 1 with {2,2} block offset along the diagonal. This is sometimes referred to as the "Margolus neighborhood". More algorithm design regarding phases and offsets remains to be done to implement full dimensional generalization of ResourceFunction["BlockCellularAutomaton"].
Possible forms for time t are:
t | all steps 0 through t |
{t} | a list containing only step t |
{{t}} | step t alone |
{t1,t2} | steps t1 through t2 |
{t1,t2,dt} | steps t1,t1+dt, … |
List items in the output of
ResourceFunction["BlockCellularAutomaton"] take the form {
statei,
phasei}, where
phase goes from
0,1,…,dim-1 and
dim is the fixed block length. To obtain an
ArrayPlot of a time evolution, simply discard
phase information by combining
Map and
First, as in examples given below.
The length of init should be commensurate with the block size dim.
Previous versions of this code used a different phase convention, phase ∈{1,2,…, dim}. Backward-compatible usage expects a phase in the previous convention and automatically subtracts one to convert to the present convention.