Homework 10

Out: Tue 7 April 1998
Due: One week

This assignment is meant to exercise your understanding of recursion. You are to write a program to draw the recursively defined Koch Snowflake.

Reading: Read chapter 6 on arrays and chapter 12 on recursion.

Programming:

The drawing of the snowflake is described recursively. given two points, p and q, a snowflake of depth 0 from p to q is a line from p to q. If the depth is greater than 0:
  1. Divide the segment from p to q into three equal parts.
  2. Replace the middle third with two parts, each equal in length to the third removed, and buckled upwards to make them fit.
  3. On each of the four parts, build a snowflake of depth one less.
See the applet below for an example of this construction.

The Koch Snowflake Applet



Use PostIt to submit your homework. There are further instructions about how to do this.