Recently my stochastic professor introduced me to a problem he has been pondering for over two decades: on the two-dimensional integer lattice one shall flip a three-sided coin for each point and uniformly place one of three mirrors, , where denotes not placing a mirror. After having populated the world, one picks their favorite integer tuple and points a beam of light in one of the four cardinal directions. With what probability does the light fall into a loop, never fully escaping?
This program uses two positions and a color to create beautiful images.
- ‘q’ saves the current image
- Space pauses and resumes the image’s creation
# Python 2.7.7 Code # Pygame 1.9.1 (for Python 2.7.7) # Jonathan Frech 21st of September, 2015 # edited 23rd of September, 2015 # edited 24th of September, 2015
Starting at the screen’s center, this program draws randomly long lines in a random direction. The lines cannot leave the screen.
# Python 2.7.7 Code # Pygame 1.9.1 (for Python 2.7.7) # Jonathan Frech 28th of August, 2015