This is a demonstration of the percolation problem with square grids

http://introcs.cs.princeton.edu/java/24percolation/


In [4]:
from percolation import *

# top-down percolcation systems can be easily constructed by 
# specifying the percolation probability and size of the system
# (side length of the square system)
systems = map(lambda j:M(0.58,20),range(10))

# union all open sites that are connected to top open sites
systems = map(lambda s: union(s),systems)

# red is full sites, title shows whether percolation occurs
output = map(lambda s:plot(s), systems)



In [ ]: