Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Download

A (one dimensional) cellular automaton is a function1 F : Σ → Σ with the property that there is a K > 0 such that F (x)i depends only on the 2K + 1 coordinates xi−K , xi−K+1, . . . , xi−1, xi, xi+1, . . . , xi+K . A periodic point of σ is any x such that σ^p (x) = x for some p ∈ N, and a periodic point of F is any x such that F^q (x) = x for some q ∈ N. Given a cellular automaton F, a point x ∈ Σ is jointly periodic if there are p, q ∈ N such that σ^p (x) = F^q (x) = x, that is, it is a periodic point under both functions.

This project aims to explore the nature of one-dimensional Cellular Automata, in the hope of finding the structure of cellular automata through its periodic points.

2034 views
License: MIT
ubuntu2004
1
import cellpylib as cpl
2
import sys
3
4
def gen_auto(init_size: int = 100, rule_number: int = 30, random: bool = True):
5
# Initialize the CA
6
auto = cpl.init_random(init_size) if random else cpl.init_simple(init_size)
7
8
# Evolve the CA according to the intended rule
9
return cpl.evolve(auto, timesteps=(init_size//2)+1, memoize="recursive",
10
apply_rule=lambda n, c, t: cpl.nks_rule(n, rule_number))
11
12
def main():
13
if (len(sys.argv) < 2):
14
raise Exception ("Need to provide rule(s) as arguments")
15
16
args = list(map(int, sys.argv[1:]))
17
18
autos = []
19
titles = []
20
21
for i in args:
22
titles.append("Rule {}".format(i))
23
24
for i in args:
25
autos.append(gen_auto(rule_number=i))
26
27
cpl.plot_multiple(autos, titles)
28
29
30
if __name__ == "__main__":
31
main()
32
33
34