This program allows the user to place balls on the canvas using the mouse. On exiting the window, a simulation of a "chain reaction" begins: the most recently drawn ball hits into the second most recently drawn, which hits into the next ball, and so on. If the mouse exits from the bottom of the window a colorful chain reaction will occur. This program demonstrates the use of a recursive list which keeps track of the balls.
Click below to download the source files for ChainReaction.