Population simulation

Conway's Game of Life

https://upload.wikimedia.org/wikipedia/commons/thumb/0/04/John_H_Conway_2005_%28cropped%29.jpg/288px-John_H_Conway_2005_%28cropped%29.jpg

In [11]:
%matplotlib inline
import matplotlib.pyplot as plt
plt.rcParams["animation.html"] = "jshtml"
import matplotlib.animation
import numpy as np

t = np.linspace(0, 2*np.pi, 1000)
x = np.sin(t)

fig, ax = plt.subplots()
plt.close()
l, = ax.plot([0,2*np.pi],[-1,1])

animate = lambda i: l.set_data(t[:i], x[:i])

ani = matplotlib.animation.FuncAnimation(fig, animate, frames=len(t), interval=5)
ani
Out[11]:


Once Loop Reflect