setup
button to setup the triangular array of
nails. Click the go
button to start the balls dropping
through the nails.
The depth
slider controls the depth of the triangular array
of nails.
There is a "bar" at the bottom of the screen to stop the
balls from falling. Click to remove-bar
button to remove the
bar. The balls will continue to fall, "wrapping" back to the
top of the screen and falling through the array of nails
again. Click add-bar
to re-insert the bar at the bottom of
the screen.
When you remove the bar at the bottom of the screen (by
clicking the remove-bar
button), the balls "wrap" and fall
through the nails again. So each point in the original
Gaussian distribution becomes a mini-Gaussian distribution.
The overall distribution is the sum of these mini-Gaussian
distributions.
fall
program so that balls are biased to shift to
the left when they hit nails (perhaps going to the left 75%
of the time). What is the effect on the resulting
distribution?
setup-triangle
procedure uses a special type of "turtle
recursion." When a turtle runs the procedure, it hatches two
new turtles, each of which runs setup-triangle
. The original
turtle then dies. The current depth of the recursion is kept
as a local state variable in the turtles.
The new-ball
procedure creates a new ball and places it at
the top of the screen. There is a button that runs the
new-ball
procedure every 0.2 seconds. An alternate approach:
Place one turtle at the top of the screen and make it
continually hatch
new turtles. (But you must make sure that
the "hatching" turtle doesn't fall like the other turtles.)