For this week's lab, we will be playing with recursion. For a majority of the lab, you will be using recursion to draw pictures using turtle graphics. To make sure that you can focus on the recursion, for the prelab this week, we'll be working out some of the numerical details. For each section below (1-3) answer the question at the end in bold and bring it to class on Friday for your prelab.
A level 2 recursive H has another H at the end of each line:
A level 3 recursive H has another H at the end of the each of these Hs:
Notice that the smallest level of H always ends in a dot.
Each of these figures is made up of many Hs. An H is defined by x, y coordinates and a length, L. The x,y coordinates are at the center of the H. The vertical bars are of length L and the horizontal bar of length 2L.
Given an H at x, y with length L, what are the 4 coordinates of the ends of the vertical bars of that H (that, is the upper left, lower left, upper right and lower right of the H) relative to the supplied x, y?
To draw stairs, we first draw a large square in the lower left. We then draw a set of stairs above it and to the right that are half as large:
Stairs are specified by the x, y coordinates of the bottom left corner of the stairs and the length l of a side of the square in the lower left hand corner. If we drew stairs starting at x, y with length l what would be the coordinates of the recursive set of stairs above and the recursive set of stairs to the right of the initial square, again relative to x, y?
>>> fillcolor(0, 1, 0) >>> begin_fill() >>> circle(50) >>> end_fill()will draw a green circle. See what happens as you change these three numbers. What would be the RGB values if we wanted a light blue color?