Python simulation code for plotopia.com blog post