This demo simulates the growth of a sunflower. The distribution of seeds is guided by the Golden Ratio phi= 1.618... In the code you can see that every 360/phi degrees a new seed is produced. This spacing of seeds guided by the division with the irrational number phi leads to optimal spreading of the seeds competing for resources such as sunlight. Every other seed is colored red so it is easier to see the spiral patterns.
My thanks to Nick Jackiw, the creator of Geometer's Sketchpad who first demonstrated me the ideas used in this demo.