Skip to content

Latest commit

 

History

History
25 lines (17 loc) · 1.23 KB

README.md

File metadata and controls

25 lines (17 loc) · 1.23 KB

1D Cellular Automata with Totalistic Rules

The number of states, or colors, that a cell in a Cellular Automaton can adopt is given by k. For example, in a binary Cellular Automaton a cell can assume only values of 0 and 1, and thus has k = 2. A built-in function, totalistic_ca, is an implementation of the Totalistic Cellular Automaton rule, as described in Wolfram's NKS. The code snippet below illustrates using this rule. A value of k of 3 is used, but any value between (and including) 2 and 36 is currently supported. The rule number is given in base 10 but is interpreted as the rule in base k (thus rule 777 corresponds to '1001210' when k = 3).

import netomaton as ntm

network = ntm.topology.cellular_automaton(n=200)

initial_conditions = [0]*100 + [1] + [0]*99

trajectory = ntm.evolve(initial_conditions=initial_conditions, network=network,
                        activity_rule=ntm.rules.totalistic_ca(k=3, rule=777), timesteps=100)

ntm.plot_activities(trajectory)

The full source code for this example can be found here.