n = 100
north,south,east,west = getgrid(n*2)
north[int(n-10):int(n+10),int(n-10):int(n+10)] = np.ones(20)
south[int(n-10):int(n+10),int(n-10):int(n+10)] = np.ones(20)
east[int(n-10):int(n+10),int(n-10):int(n+10)] = np.ones(20)
west[int(n-10):int(n+10),int(n-10):int(n+10)] = np.ones(20)
j = 0
while j < 10*n:
north[np.random.randint(1, n*2),np.random.randint(1, n*2)] = 1
east[np.random.randint(1, n*2),np.random.randint(1, n*2)] = 1
south[np.random.randint(1, n*2),np.random.randint(1, n*2)] = 1
west[np.random.randint(1, n*2),np.random.randint(1, n*2)] = 1
j+=1
fig = plt.figure()
fig=plt.figure(figsize=(10, 10), dpi= 80, facecolor='w', edgecolor='k')
j = 0
image = []
for i in range(500):
j += 1
north,south,east,west = propegate(north,south,east,west)
im = plt.imshow(north*11.02**10+south*11.05**10+east*11.01**10+west*11.03**10, animated=True,alpha=1,cmap=plt.get_cmap('viridis'))
image.append([im])
anim = animation.ArtistAnimation(fig, image, interval=100, blit=True, repeat = True)
plt.close()
HTML(anim.to_html5_video())