-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathLifePuffer.py
More file actions
54 lines (41 loc) · 1.08 KB
/
Copy pathLifePuffer.py
File metadata and controls
54 lines (41 loc) · 1.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
""" Code example from Complexity and Computation, a book about
exploring complexity science with Python. Available free from
http://greenteapress.com/complexity
Copyright 2016 Allen Downey
MIT License: http://opensource.org/licenses/MIT
"""
from __future__ import print_function, division
import sys
import matplotlib.pyplot as plt
from Life import Life, LifeViewer
def main(script, *args):
"""Constructs a puffer train.
Uses the entities in this file:
http://www.radicaleye.com/lifepage/patterns/puftrain.lif
"""
lwss = [
'0001',
'00001',
'10001',
'01111'
]
bhep = [
'1',
'011',
'001',
'001',
'01'
]
n = 400
m = 600
life = Life(n, m)
col = 120
life.add_cells(n//2+12, col, *lwss)
life.add_cells(n//2+26, col, *lwss)
life.add_cells(n//2+19, col, *bhep)
viewer = LifeViewer(life)
anim = viewer.animate(frames=100, interval=1)
plt.subplots_adjust(left=0.01, right=0.99, bottom=0.01, top=0.99)
plt.show()
if __name__ == '__main__':
main(*sys.argv)