Instructions for treeParts

(produced at 11:51 a.m. UTC on 2024-09-16)

This task is part of project03 which is due at 23:00 EDT on 2024-09-24.

You have the option to work with a partner on this task if you wish. Working with a partner requires more work to coordinate schedules, but if you work together and make sure that you are both understanding the code you write, you will make progress faster and learn more.

You can download the starter code for this task using this link.

You can submit this task using this link.

Put all of your work for this task into the file treeParts.py
(which is provided among the starter files)

For this problem set, you have a choice: you may complete this task OR the musicalMeasures task, but you do not need to complete both. treeParts (this task) is graphics-oriented and works with turtle graphics, while musicalMeasures is based on audio and music instead, using the wavesynth library.

This task will help you practice the material on custom functions and how to use several functions together to achieve a complicated result.

In this task, your ultimate goal is to draw leaves, twigs, branches, and ultimately trees, like these ones:

Seven trees arranged into a back row of four trees and a front row of
three trees. Each tree is slightly different in terms of the lengths and
angles of the branches and twigs, but they each have one trunk that spits
into four branches, each of which splits into three twigs each of which
has two leaves at the end. There are circular orange fruits drawn hanging
from the end of each branch. A single tree with silver-gray bark. It has the same structure as the
trees in the previous example, with four branches, twelve twigs, and
twenty-four leaves. This one has four pink flowers at the end of each
branch, instead of fruit.

You will accomplish this task by completing several subtasks. You should do these subtasks in order.

You are free to design your tree however you'd like: your functions may use parameters or not, and may or may not have return values. However, there are two restrictions: each function must draw something, and except for main, they must each move the turtle back to wherever it started when the function was called.

Subtask A: leaf

The leaf function has been provided for you, but you are free to modify it, including by changing the number of parameters used, what it draws, or the return value. The provided leaf function illustrates one strategy for returning the turtle to where it started: after drawing what you want to draw, move backwards retracing your steps to get back to where you started.

It does still need to draw something.

Subtask B: twig

The twig function must draw something, and must call leaf at lest twice. As with leaf, it must put the turtle back where it started when it's done..

The first example shows how the twig function could work, but remember that you're free to have it draw whatever you want, and you do not have to stick to the suggested parameters or return value.

Subtask C: branch

Just like the twig function, the branch function must:

  1. Draw something,
  2. call twig at least twice,
  3. put the turtle back where it started when it's done

Also, it must call either left or right to turn the turtle at some point.

This example shows one way the branch function could work.

Subtask D: tree

The tree function must:

  1. Draw something,
  2. call branch at least twice,
  3. put the turtle back where it started when it's done
  4. call either left or right to turn the turtle at some point.

This example shows one way the tree function could work.

Subtask E: main

Because you're free to design your tree function with any number of parameters, there's now way for us to call your tree function directly. To solve this issue, you must define a main function which has zero parameters and which calls your tree function at least once. Unlike the other functions, the main function does not need to call any drawing functions directly. It must complete without crashing, however.

We recommend adding a call to your main function at the end of your file so that it will be called every time you run the file.

This example shows one way the main function could work.

Testing

We have provided a file named test_treeParts.py which can be used to check some of the constraints specified above, but you should rely on Potluck for thorough testing. We recommend that you test each function as you build it, because the lessons you learn from debugging your earlier functions will help you improve the later functions.

If you want to test that you are returning to the starting position for the twig, branch, and tree functions, follow the instructions in test_treeParts.py to fill in the required example functions and uncomment the extra testing call at the end of that file.

We recommend you use noTrace and showPicture to speed up drawing, although turning them off while debugging can also be informative.

Notes

Examples

Twig

This example shows what the twig function might draw, print, and return (note that your twig function does not have to be fruitful). Note that when the function is finished, the turtle is positioned back at the base of the twig, in the same place (and oriented in the same direction) that it started in. This is true for the following examples as well.

In []:
# Draw the twig: top = twig(10, 100, 'Sienna', 'SpringGreen2') # Show the turtle's position (it's back at the start) color('black') stamp()
Prints
A 10-pensize Sienna horizontal line from (0, 0) to (100, 0). Start of filled shape. A 2-pensize SpringGreen2 ellipse centered at (123, 9) with a 25-unit major axis at 20° and a 16.7-unit minor axis Filled in shape using SpringGreen2. Start of filled shape. A 2-pensize SpringGreen2 ellipse centered at (123, -9) with a 25-unit major axis at 160° and a 16.7-unit minor axis Filled in shape using SpringGreen2.
Out[]:
232
Image 
A brown twig (a line) pointing to the right of the origin, with two
thick rounded green lines (leaves) attached to its end. The leaves are
angled +20° and -20° relative to the twig itself, which is perfectly
horizontal.

Branch

This example shows what the branch function might draw, print, and return. As with the twig, your function does not need to return anything. Note how the turtle returns to where it started even though it did not start at the origin.

In []:
# First, rotate a bit and back up lt(25) leap(-60) # Draw the branch: top = branch(12, 80, 50, 'Wheat4', 'DarkOliveGreen2', 'LightGray') # Show the turtle's position (it's back at the start) color('black') stamp()
Prints
A 12-pensize Wheat4 25° line from (-54, -25) to (18, 8). A 12-pensize Wheat4 65° line from (18, 8) to (39, 54). Start of filled shape. A 2-pensize DarkOliveGreen2 ellipse centered at (40, 66) with a 12.5-unit major axis at 85° and a 8.3-unit minor axis Filled in shape using DarkOliveGreen2. Start of filled shape. A 2-pensize DarkOliveGreen2 ellipse centered at (48, 63) with a 12.5-unit major axis at 45° and a 8.3-unit minor axis Filled in shape using DarkOliveGreen2. A 12-pensize Wheat4 25° line from (18, 8) to (63, 30). Start of filled shape. A 2-pensize DarkOliveGreen2 ellipse centered at (72, 38) with a 12.5-unit major axis at 45° and a 8.3-unit minor axis Filled in shape using DarkOliveGreen2. Start of filled shape. A 2-pensize DarkOliveGreen2 ellipse centered at (76, 31) with a 12.5-unit major axis at 5° and a 8.3-unit minor axis Filled in shape using DarkOliveGreen2. A 12-pensize Wheat4 165° line from (18, 8) to (66, -4). Start of filled shape. A 2-pensize DarkOliveGreen2 ellipse centered at (79, -3) with a 12.5-unit major axis at 5° and a 8.3-unit minor axis Filled in shape using DarkOliveGreen2. Start of filled shape. A 2-pensize DarkOliveGreen2 ellipse centered at (77, -12) with a 12.5-unit major axis at 145° and a 8.3-unit minor axis Filled in shape using DarkOliveGreen2. Start of filled shape. A 2-pensize LightGray ellipse centered at (24, 11) with a 6.8-unit major axis at 25° and a 4.5-unit minor axis Filled in shape using LightGray. Start of filled shape. A 2-pensize LightGray ellipse centered at (23, 4) with a 6.8-unit major axis at 133° and a 4.5-unit minor axis Filled in shape using LightGray. Start of filled shape. A 2-pensize LightGray ellipse centered at (15, 3) with a 6.8-unit major axis at 61° and a 4.5-unit minor axis Filled in shape using LightGray. Start of filled shape. A 2-pensize LightGray ellipse centered at (11, 10) with a 6.8-unit major axis at 169° and a 4.5-unit minor axis Filled in shape using LightGray. Start of filled shape. A 2-pensize LightGray ellipse centered at (17, 15) with a 6.8-unit major axis at 97° and a 4.5-unit minor axis Filled in shape using LightGray. Start of filled shape. A 2-pensize LightGray circle centered at (18, 8) with radius 3.4 Filled in shape using LightGray.
Out[]:
261
Image 
A brown branch pointing 25° up and to the right, starting below and to
the left of the origin and passing through it. It has three twigs
attached to its end, each of which is a brown line with two green lines
(leaves) attached (see previous description). The twigs are angled at
-40°, 0°, and +40° relative to the angle of the branch, and their bases
are at the tip of the line that forms the branch. Where the branch forks
out into twigs, there is a 5-petaled gray flower. At the base of the
branch is a black arrow showing the turtle's final position: back where
it started.

Tree

This example shows what the tree function might draw, print, and return. Once again, your result value doesn't have to be like this, and you don't need a return value at all if you don't want one. Notice that the turtle's final position (indicated by the black stamp) is the same as its starting position.

In []:
# Setup teleport(0, -140) left(85) # Draw the tree tree(18, 210, 140, 60, "Chocolate4", "Chartreuse2", "red") # Show the turtle's position (it's back at the start) color('black') stamp()
Prints
A 18-pensize Chocolate4 85° line from (0, -140) to (18, 69). A 9-pensize Chocolate4 25° line from (18, 69) to (145, 128). A 9-pensize Chocolate4 65° line from (145, 128) to (171, 183). Start of filled shape. A 2-pensize Chartreuse2 ellipse centered at (172, 198) with a 15-unit major axis at 85° and a 10-unit minor axis Filled in shape using Chartreuse2. Start of filled shape. A 2-pensize Chartreuse2 ellipse centered at (181, 193) with a 15-unit major axis at 45° and a 10-unit minor axis Filled in shape using Chartreuse2. A 9-pensize Chocolate4 25° line from (145, 128) to (200, 154). Start of filled shape. A 2-pensize Chartreuse2 ellipse centered at (210, 164) with a 15-unit major axis at 45° and a 10-unit minor axis Filled in shape using Chartreuse2. Start of filled shape. A 2-pensize Chartreuse2 ellipse centered at (215, 155) with a 15-unit major axis at 5° and a 10-unit minor axis Filled in shape using Chartreuse2. A 9-pensize Chocolate4 165° line from (145, 128) to (203, 113). Start of filled shape. A 2-pensize Chartreuse2 ellipse centered at (218, 114) with a 15-unit major axis at 5° and a 10-unit minor axis Filled in shape using Chartreuse2. Start of filled shape. A 2-pensize Chartreuse2 ellipse centered at (215, 104) with a 15-unit major axis at 145° and a 10-unit minor axis Filled in shape using Chartreuse2. Start of filled shape. A 2-pensize red ellipse centered at (153, 132) with a 8.1-unit major axis at 25° and a 5.4-unit minor axis Filled in shape using red. Start of filled shape. A 2-pensize red ellipse centered at (151, 122) with a 8.1-unit major axis at 133° and a 5.4-unit minor axis Filled in shape using red. Start of filled shape. A 2-pensize red ellipse centered at (141, 121) with a 8.1-unit major axis at 61° and a 5.4-unit minor axis Filled in shape using red. Start of filled shape. A 2-pensize red ellipse centered at (137, 130) with a 8.1-unit major axis at 169° and a 5.4-unit minor axis Filled in shape using red. Start of filled shape. A 2-pensize red ellipse centered at (144, 136) with a 8.1-unit major axis at 97° and a 5.4-unit minor axis Filled in shape using red. Start of filled shape. A 2-pensize red circle centered at (145, 128) with radius 4.1 Filled in shape using red. A 9-pensize Chocolate4 65° line from (18, 69) to (77, 196). A 9-pensize Chocolate4 105° line from (77, 196) to (62, 254). Start of filled shape. A 2-pensize Chartreuse2 ellipse centered at (53, 266) with a 15-unit major axis at 125° and a 10-unit minor axis Filled in shape using Chartreuse2. Start of filled shape. A 2-pensize Chartreuse2 ellipse centered at (63, 269) with a 15-unit major axis at 85° and a 10-unit minor axis Filled in shape using Chartreuse2. A 9-pensize Chocolate4 65° line from (77, 196) to (103, 250). Start of filled shape. A 2-pensize Chartreuse2 ellipse centered at (104, 265) with a 15-unit major axis at 85° and a 10-unit minor axis Filled in shape using Chartreuse2. Start of filled shape. A 2-pensize Chartreuse2 ellipse centered at (113, 261) with a 15-unit major axis at 45° and a 10-unit minor axis Filled in shape using Chartreuse2. A 9-pensize Chocolate4 25° line from (77, 196) to (132, 221). Start of filled shape. A 2-pensize Chartreuse2 ellipse centered at (142, 232) with a 15-unit major axis at 45° and a 10-unit minor axis Filled in shape using Chartreuse2. Start of filled shape. A 2-pensize Chartreuse2 ellipse centered at (147, 223) with a 15-unit major axis at 5° and a 10-unit minor axis Filled in shape using Chartreuse2. Start of filled shape. A 2-pensize red ellipse centered at (81, 203) with a 8.1-unit major axis at 65° and a 5.4-unit minor axis Filled in shape using red. Start of filled shape. A 2-pensize red ellipse centered at (86, 195) with a 8.1-unit major axis at 173° and a 5.4-unit minor axis Filled in shape using red. Start of filled shape. A 2-pensize red ellipse centered at (79, 188) with a 8.1-unit major axis at 101° and a 5.4-unit minor axis Filled in shape using red. Start of filled shape. A 2-pensize red ellipse centered at (70, 192) with a 8.1-unit major axis at 29° and a 5.4-unit minor axis Filled in shape using red. Start of filled shape. A 2-pensize red ellipse centered at (72, 202) with a 8.1-unit major axis at 137° and a 5.4-unit minor axis Filled in shape using red. Start of filled shape. A 2-pensize red circle centered at (77, 196) with radius 4.1 Filled in shape using red. A 9-pensize Chocolate4 105° line from (18, 69) to (-18, 204). A 9-pensize Chocolate4 145° line from (-18, 204) to (-67, 239). Start of filled shape. A 2-pensize Chartreuse2 ellipse centered at (-82, 243) with a 15-unit major axis at 165° and a 10-unit minor axis Filled in shape using Chartreuse2. Start of filled shape. A 2-pensize Chartreuse2 ellipse centered at (-76, 251) with a 15-unit major axis at 125° and a 10-unit minor axis Filled in shape using Chartreuse2. A 9-pensize Chocolate4 105° line from (-18, 204) to (-33, 262). Start of filled shape. A 2-pensize Chartreuse2 ellipse centered at (-42, 275) with a 15-unit major axis at 125° and a 10-unit minor axis Filled in shape using Chartreuse2. Start of filled shape. A 2-pensize Chartreuse2 ellipse centered at (-32, 277) with a 15-unit major axis at 85° and a 10-unit minor axis Filled in shape using Chartreuse2. A 9-pensize Chocolate4 65° line from (-18, 204) to (7, 259). Start of filled shape. A 2-pensize Chartreuse2 ellipse centered at (9, 274) with a 15-unit major axis at 85° and a 10-unit minor axis Filled in shape using Chartreuse2. Start of filled shape. A 2-pensize Chartreuse2 ellipse centered at (18, 269) with a 15-unit major axis at 45° and a 10-unit minor axis Filled in shape using Chartreuse2. Start of filled shape. A 2-pensize red ellipse centered at (-20, 212) with a 8.1-unit major axis at 105° and a 5.4-unit minor axis Filled in shape using red. Start of filled shape. A 2-pensize red ellipse centered at (-11, 209) with a 8.1-unit major axis at 33° and a 5.4-unit minor axis Filled in shape using red. Start of filled shape. A 2-pensize red ellipse centered at (-12, 199) with a 8.1-unit major axis at 141° and a 5.4-unit minor axis Filled in shape using red. Start of filled shape. A 2-pensize red ellipse centered at (-21, 197) with a 8.1-unit major axis at 69° and a 5.4-unit minor axis Filled in shape using red. Start of filled shape. A 2-pensize red ellipse centered at (-26, 205) with a 8.1-unit major axis at 177° and a 5.4-unit minor axis Filled in shape using red. Start of filled shape. A 2-pensize red circle centered at (-18, 204) with radius 4.1 Filled in shape using red. A 9-pensize Chocolate4 145° line from (18, 69) to (-96, 150). A 9-pensize Chocolate4 5° line from (-96, 150) to (-156, 144). Start of filled shape. A 2-pensize Chartreuse2 ellipse centered at (-170, 138) with a 15-unit major axis at 25° and a 10-unit minor axis Filled in shape using Chartreuse2. Start of filled shape. A 2-pensize Chartreuse2 ellipse centered at (-171, 148) with a 15-unit major axis at 165° and a 10-unit minor axis Filled in shape using Chartreuse2. A 9-pensize Chocolate4 145° line from (-96, 150) to (-146, 184). Start of filled shape. A 2-pensize Chartreuse2 ellipse centered at (-160, 188) with a 15-unit major axis at 165° and a 10-unit minor axis Filled in shape using Chartreuse2. Start of filled shape. A 2-pensize Chartreuse2 ellipse centered at (-154, 196) with a 15-unit major axis at 125° and a 10-unit minor axis Filled in shape using Chartreuse2. A 9-pensize Chocolate4 105° line from (-96, 150) to (-112, 207). Start of filled shape. A 2-pensize Chartreuse2 ellipse centered at (-121, 220) with a 15-unit major axis at 125° and a 10-unit minor axis Filled in shape using Chartreuse2. Start of filled shape. A 2-pensize Chartreuse2 ellipse centered at (-111, 222) with a 15-unit major axis at 85° and a 10-unit minor axis Filled in shape using Chartreuse2. Start of filled shape. A 2-pensize red ellipse centered at (-103, 154) with a 8.1-unit major axis at 145° and a 5.4-unit minor axis Filled in shape using red. Start of filled shape. A 2-pensize red ellipse centered at (-94, 157) with a 8.1-unit major axis at 73° and a 5.4-unit minor axis Filled in shape using red. Start of filled shape. A 2-pensize red ellipse centered at (-88, 150) with a 8.1-unit major axis at 1° and a 5.4-unit minor axis Filled in shape using red. Start of filled shape. A 2-pensize red ellipse centered at (-94, 142) with a 8.1-unit major axis at 109° and a 5.4-unit minor axis Filled in shape using red. Start of filled shape. A 2-pensize red ellipse centered at (-103, 145) with a 8.1-unit major axis at 37° and a 5.4-unit minor axis Filled in shape using red. Start of filled shape. A 2-pensize red circle centered at (-96, 150) with radius 4.1 Filled in shape using red.
Out[]:
372
Image 
A brown tree consisting of a line pointing 85° upwards with four branches
sprouting from its tip, starting from below the origin. Each branch has
the structure described earlier including three twigs and two leaves per
twig. The branches are at -60°, -20°, +20°, and +60° relative to the
trunk. It has red flowers at the base of each group of twigs. Note that
the widths of the branches and twigs are half the width of the trunk. A
black arrow at the base of the tree indicates where it ended up, which is
also where it started.

Main

This example shows how the main function doesn't accept any parameters. This is required so that we can test your code without knowing what parameters you chose to put in your tree function. The turtle does NOT have to end up back where it started, and you can (like in this example) call tree more than once if you like.

In []:
# Draw the tree(s) main() # Show the turtle's position (it's NOT back at the start) color('black') stamp()
Prints
A 15-pensize Sienna vertical line from (0, -120) to (0, 60). A 7.5-pensize Sienna 30° line from (0, 60) to (104, 120). A 7.5-pensize Sienna 70° line from (104, 120) to (124, 176). Start of filled shape. A 2-pensize SpringGreen1 ellipse centered at (124, 191) with a 15-unit vertical major axis and a 10-unit minor axis Filled in shape using SpringGreen1. Start of filled shape. A 2-pensize SpringGreen1 ellipse centered at (134, 188) with a 15-unit major axis at 50° and a 10-unit minor axis Filled in shape using SpringGreen1. A 7.5-pensize Sienna 30° line from (104, 120) to (156, 150). Start of filled shape. A 2-pensize SpringGreen1 ellipse centered at (166, 161) with a 15-unit major axis at 50° and a 10-unit minor axis Filled in shape using SpringGreen1. Start of filled shape. A 2-pensize SpringGreen1 ellipse centered at (171, 153) with a 15-unit major axis at 10° and a 10-unit minor axis Filled in shape using SpringGreen1. A 7.5-pensize Sienna 170° line from (104, 120) to (163, 110). Start of filled shape. A 2-pensize SpringGreen1 ellipse centered at (178, 112) with a 15-unit major axis at 10° and a 10-unit minor axis Filled in shape using SpringGreen1. Start of filled shape. A 2-pensize SpringGreen1 ellipse centered at (176, 102) with a 15-unit major axis at 150° and a 10-unit minor axis Filled in shape using SpringGreen1. Start of filled shape. A 2-pensize pink ellipse centered at (111, 124) with a 8.1-unit major axis at 30° and a 5.4-unit minor axis Filled in shape using pink. Start of filled shape. A 2-pensize pink ellipse centered at (110, 115) with a 8.1-unit major axis at 138° and a 5.4-unit minor axis Filled in shape using pink. Start of filled shape. A 2-pensize pink ellipse centered at (101, 113) with a 8.1-unit major axis at 66° and a 5.4-unit minor axis Filled in shape using pink. Start of filled shape. A 2-pensize pink ellipse centered at (96, 121) with a 8.1-unit major axis at 174° and a 5.4-unit minor axis Filled in shape using pink. Start of filled shape. A 2-pensize pink ellipse centered at (102, 128) with a 8.1-unit major axis at 102° and a 5.4-unit minor axis Filled in shape using pink. Start of filled shape. A 2-pensize pink circle centered at (104, 120) with radius 4.1 Filled in shape using pink. A 7.5-pensize Sienna 70° line from (0, 60) to (41, 173). A 7.5-pensize Sienna 110° line from (41, 173) to (21, 229). Start of filled shape. A 2-pensize SpringGreen1 ellipse centered at (11, 241) with a 15-unit major axis at 130° and a 10-unit minor axis Filled in shape using SpringGreen1. Start of filled shape. A 2-pensize SpringGreen1 ellipse centered at (21, 244) with a 15-unit vertical major axis and a 10-unit minor axis Filled in shape using SpringGreen1. A 7.5-pensize Sienna 70° line from (41, 173) to (62, 229). Start of filled shape. A 2-pensize SpringGreen1 ellipse centered at (62, 244) with a 15-unit vertical major axis and a 10-unit minor axis Filled in shape using SpringGreen1. Start of filled shape. A 2-pensize SpringGreen1 ellipse centered at (71, 241) with a 15-unit major axis at 50° and a 10-unit minor axis Filled in shape using SpringGreen1. A 7.5-pensize Sienna 30° line from (41, 173) to (93, 203). Start of filled shape. A 2-pensize SpringGreen1 ellipse centered at (103, 214) with a 15-unit major axis at 50° and a 10-unit minor axis Filled in shape using SpringGreen1. Start of filled shape. A 2-pensize SpringGreen1 ellipse centered at (108, 205) with a 15-unit major axis at 10° and a 10-unit minor axis Filled in shape using SpringGreen1. Start of filled shape. A 2-pensize pink ellipse centered at (44, 180) with a 8.1-unit major axis at 70° and a 5.4-unit minor axis Filled in shape using pink. Start of filled shape. A 2-pensize pink ellipse centered at (49, 172) with a 8.1-unit major axis at 178° and a 5.4-unit minor axis Filled in shape using pink. Start of filled shape. A 2-pensize pink ellipse centered at (43, 165) with a 8.1-unit major axis at 106° and a 5.4-unit minor axis Filled in shape using pink. Start of filled shape. A 2-pensize pink ellipse centered at (34, 168) with a 8.1-unit major axis at 34° and a 5.4-unit minor axis Filled in shape using pink. Start of filled shape. A 2-pensize pink ellipse centered at (35, 178) with a 8.1-unit major axis at 142° and a 5.4-unit minor axis Filled in shape using pink. Start of filled shape. A 2-pensize pink circle centered at (41, 173) with radius 4.1 Filled in shape using pink. A 7.5-pensize Sienna 110° line from (0, 60) to (-41, 173). A 7.5-pensize Sienna 150° line from (-41, 173) to (-93, 203). Start of filled shape. A 2-pensize SpringGreen1 ellipse centered at (-108, 205) with a 15-unit major axis at 170° and a 10-unit minor axis Filled in shape using SpringGreen1. Start of filled shape. A 2-pensize SpringGreen1 ellipse centered at (-103, 214) with a 15-unit major axis at 130° and a 10-unit minor axis Filled in shape using SpringGreen1. A 7.5-pensize Sienna 110° line from (-41, 173) to (-62, 229). Start of filled shape. A 2-pensize SpringGreen1 ellipse centered at (-71, 241) with a 15-unit major axis at 130° and a 10-unit minor axis Filled in shape using SpringGreen1. Start of filled shape. A 2-pensize SpringGreen1 ellipse centered at (-62, 244) with a 15-unit vertical major axis and a 10-unit minor axis Filled in shape using SpringGreen1. A 7.5-pensize Sienna 70° line from (-41, 173) to (-21, 229). Start of filled shape. A 2-pensize SpringGreen1 ellipse centered at (-21, 244) with a 15-unit vertical major axis and a 10-unit minor axis Filled in shape using SpringGreen1. Start of filled shape. A 2-pensize SpringGreen1 ellipse centered at (-11, 241) with a 15-unit major axis at 50° and a 10-unit minor axis Filled in shape using SpringGreen1. Start of filled shape. A 2-pensize pink ellipse centered at (-44, 180) with a 8.1-unit major axis at 110° and a 5.4-unit minor axis Filled in shape using pink. Start of filled shape. A 2-pensize pink ellipse centered at (-35, 178) with a 8.1-unit major axis at 38° and a 5.4-unit minor axis Filled in shape using pink. Start of filled shape. A 2-pensize pink ellipse centered at (-34, 168) with a 8.1-unit major axis at 146° and a 5.4-unit minor axis Filled in shape using pink. Start of filled shape. A 2-pensize pink ellipse centered at (-43, 165) with a 8.1-unit major axis at 74° and a 5.4-unit minor axis Filled in shape using pink. Start of filled shape. A 2-pensize pink ellipse centered at (-49, 172) with a 8.1-unit major axis at 2° and a 5.4-unit minor axis Filled in shape using pink. Start of filled shape. A 2-pensize pink circle centered at (-41, 173) with radius 4.1 Filled in shape using pink. A 7.5-pensize Sienna 150° line from (0, 60) to (-104, 120). A 7.5-pensize Sienna 10° line from (-104, 120) to (-163, 110). Start of filled shape. A 2-pensize SpringGreen1 ellipse centered at (-176, 102) with a 15-unit major axis at 30° and a 10-unit minor axis Filled in shape using SpringGreen1. Start of filled shape. A 2-pensize SpringGreen1 ellipse centered at (-178, 112) with a 15-unit major axis at 170° and a 10-unit minor axis Filled in shape using SpringGreen1. A 7.5-pensize Sienna 150° line from (-104, 120) to (-156, 150). Start of filled shape. A 2-pensize SpringGreen1 ellipse centered at (-171, 153) with a 15-unit major axis at 170° and a 10-unit minor axis Filled in shape using SpringGreen1. Start of filled shape. A 2-pensize SpringGreen1 ellipse centered at (-166, 161) with a 15-unit major axis at 130° and a 10-unit minor axis Filled in shape using SpringGreen1. A 7.5-pensize Sienna 110° line from (-104, 120) to (-124, 176). Start of filled shape. A 2-pensize SpringGreen1 ellipse centered at (-134, 188) with a 15-unit major axis at 130° and a 10-unit minor axis Filled in shape using SpringGreen1. Start of filled shape. A 2-pensize SpringGreen1 ellipse centered at (-124, 191) with a 15-unit vertical major axis and a 10-unit minor axis Filled in shape using SpringGreen1. Start of filled shape. A 2-pensize pink ellipse centered at (-111, 124) with a 8.1-unit major axis at 150° and a 5.4-unit minor axis Filled in shape using pink. Start of filled shape. A 2-pensize pink ellipse centered at (-102, 128) with a 8.1-unit major axis at 78° and a 5.4-unit minor axis Filled in shape using pink. Start of filled shape. A 2-pensize pink ellipse centered at (-96, 121) with a 8.1-unit major axis at 6° and a 5.4-unit minor axis Filled in shape using pink. Start of filled shape. A 2-pensize pink ellipse centered at (-101, 113) with a 8.1-unit major axis at 114° and a 5.4-unit minor axis Filled in shape using pink. Start of filled shape. A 2-pensize pink ellipse centered at (-110, 115) with a 8.1-unit major axis at 42° and a 5.4-unit minor axis Filled in shape using pink. Start of filled shape. A 2-pensize pink circle centered at (-104, 120) with radius 4.1 Filled in shape using pink.
Out[]:
483
Image 
A single branching tree with pink flowers at the second branching points
and spring-green leaves at the tips of the twigs. The trunk branches into
4 parts and each of those branches into 3 twigs with 3 leaves each.

Rubric

Group goals:
 
unknown All functions are documented
Each function you define must include a non-empty documentation string as the very first thing in the function.
 
unknown Do not define functions inside of other functions
None of your function definitions may be placed inside of other function definitions.
 
unknown Do not ignore the results of any fruitful function calls
According to the "Don't waste fruit" principle, every place you call a fruitful function (built-in or custom) you must store the result in a variable, or that function call must be part of a larger expression that uses its return value.
 
unknown Do not create any variables that you never make use of
According to the "Don't waste boxes" principle, every time you create a variable (using = or by defining a parameter for a function) you must also later use that variable as part of another expression. If you need to create a variable that you won't use, it must have the name _, but you should only do this if absolutely necessary.
 
unknown main must not crash.
We will call your main function without any arguments. It should be able to draw something andfinish without crashing.
 
unknown main tree parts must each put the turtle back where they found it.
We will call your main function without any arguments. We will measure where the turtle moves, including where it is at the start and end of each inner function call. We will check to make sure that the position at the start of the tree and each branch, twig, and leaf is the same as the position after that function call is done, including x, y position and heading.
 
unknown Define leaf
Use def to define leaf
 
unknown leaf must call one of the required turtle drawing functions.
Within the definition of leaf, we will inspect the code for leaf and check to make sure that it includes at least one call to any of the following functions:
  1. circle
  2. drawCircle
  3. drawEllipse
  4. drawDot
  5. drawSquare
  6. drawRectangle
  7. drawPolygon
  8. drawText
  9. fd
  10. forward
 
unknown Define twig
Use def to define twig
 
unknown twig must call one of the required turtle drawing functions.
Within the definition of twig, we will inspect the code for twig and check to make sure that it includes at least one call to any of the following functions:
  1. circle
  2. drawCircle
  3. drawEllipse
  4. drawDot
  5. drawSquare
  6. drawRectangle
  7. drawPolygon
  8. drawText
  9. fd
  10. forward
 
unknown Call leaf
Within the definition of twig, call leaf in at least 2 places.
 
unknown Define branch
Use def to define branch
 
unknown branch must call one of the required turtle drawing functions.
Within the definition of branch, we will inspect the code for branch and check to make sure that it includes at least one call to any of the following functions:
  1. circle
  2. drawCircle
  3. drawEllipse
  4. drawDot
  5. drawSquare
  6. drawRectangle
  7. drawPolygon
  8. drawText
  9. fd
  10. forward
 
unknown branch must call one of the required turtle turning functions.
Within the definition of branch, we will inspect the code for branch and check to make sure that it includes at least one call to any of the following functions:
  1. circle
  2. drawCircle
  3. drawEllipse
  4. drawDot
  5. drawSquare
  6. drawRectangle
  7. drawPolygon
  8. drawText
  9. fd
  10. forward
 
unknown Call twig
Within the definition of branch, call twig in at least 2 places.
 
unknown Define tree
Use def to define tree
 
unknown tree must call one of the required turtle drawing functions.
Within the definition of tree, we will inspect the code for tree and check to make sure that it includes at least one call to any of the following functions:
  1. circle
  2. drawCircle
  3. drawEllipse
  4. drawDot
  5. drawSquare
  6. drawRectangle
  7. drawPolygon
  8. drawText
  9. fd
  10. forward
 
unknown tree must call one of the required turtle turning functions.
Within the definition of tree, we will inspect the code for tree and check to make sure that it includes at least one call to any of the following functions:
  1. circle
  2. drawCircle
  3. drawEllipse
  4. drawDot
  5. drawSquare
  6. drawRectangle
  7. drawPolygon
  8. drawText
  9. fd
  10. forward
 
unknown Call branch
Within the definition of tree, call branch in at least 2 places.
 
unknown Define main
Use def to define main
 
unknown Call tree
Within the definition of main, call tree in at least one place.