Prelab 9

Preparation for completing Lab 9 - Fractals. There is nothing to turn in for this prelab, but we suggest you sketch a plan on paper for the following two problems.

Sierpinski triangle

You will write a recursive function that draws a Sierpinski triangle.

Sierpinski

Notice there are 3 smaller Sierpinski triangles in a Sierpinski triangle. Suppose you had code to draw the 3 smaller Sierpinski triangles… how would you move the turtle to be in the right locations to start the drawings of those 3 smaller Sierpinski triangles? After drawing the third smaller Sierpinski triangle, how to get the turtle back to where it started?

Your plan might be a numbered/bulleted list like the plan we made for the Tower of Hanoi game.

Recursive H

A recursive H is an H where the end of each vertical line of the H may have another recursive H. The recursive H is defined by a level. A level 1 recursive H is just an H:

H1

A level 2 recursive H has another smaller H at the end of each line:

H2

The smallest level of H always ends in a dot, a level 0 recursive H.

Make a sketch on paper to gain insight into how a recursive H is composed of smaller recursive Hs. Write out a high-level plan for how to produce the overall recursive H from smaller ones. Again, a numbered/bulleted list is a good way to outline your plan.