June 10, 2004; Gregg M. Townsend
Requires: Version 9 graphics
This file is in the public domain.
Originally inspired by the Nova television show on chaos.
Colorization suggested by Kenneth Walker.
____________________________________________________________
This program constructs Sierpinski's triangle using an iterative
method. An initial point is chosen (by clicking the mouse inside the
triangle) and marked. Then, the program repeatedly moves half way to
a randomly chosen vertex and plots a point in the color corresponding
to the vertex.
The polygon need not be a triangle. The number of sides may be given
as a command line argument, or a digit 3 through 9 or 0 through 2 may be
pressed to establish a new polygon of 3 to 12 sides.
The S, G, E, and Q keys function identically to the Stop, Go, Erase,
Quit pushbuttons.
Source code |
Program Library Page |
Icon Home Page