This is a program that draws the famous Sierpinski Triangle and Koch Snowflake. It's just like hundreds of other programs written just like it! This is a classic example of recursive programming. As an applet, it draws the triangle. As an application, it draws the snowflake. I would be interested if anyone has a simpler solution of the snowflake.
See the program run live as an applet! (requires Java).
Download the jar file (runs on most java platforms like an executable).
Check out the source code here!
You can change the colors and fractal type in the code; I tried to keep it as simple as possible. Try modifying the draw routine to create your own fractals! In my code, the paint routine automatically makes enough recursive calls to draw the fractal with as much precision as the window size will allow. Larger windows take longer to draw than smaller windows.
2004.01.05 William Summerfield Dubel IV