Working with functions
Modularity
Playing with creative problem solving techniques
Practice with Thonny
This program creates a complex turtle structure, by putting together various functions that draw simpler turtle structures.
Since you'll be working with turtles, make sure to download turtleBeads from this folder. In a new file, called username_monsterMash.py, make sure to import all the turtle modules, as we've seen in class. For example, this is how Beyoncé Knowles would name her file: bk134_hw3_monstermash.py. This is the file you'll be submitting at the end.
For this task, we want you to write functions that use turtle graphics to draw monster pieces: tails, bodies, and heads. These functions will be combined with each other to draw a mixed-up monster. The results might look something like this image, which combines pieces from orange, green, and yellow monsters:
For this subtask, you will define three functions: monsterTail, monsterBody, and monsterHead. These functions must not take any parameters.
Each of these functions must satisfy the following requirements:
* Use the pensize function to set the pen width. Do not assume that the pen size will be 1 when the body part is started.
* Use the pencolor and fillcolor functions (or just the color function) to set both the pen and fill colors (may use the same color for both). Do not assume that the pen or fill colors will be black when the body part is started.
* Leave the pen in the "down" position at the end of the function (i.e., does not call penup without later calling pendown).
* Call at least two different turtle or turtleBeads drawing functions from the following list:
fd, forward, bk, back, backward, circle, write, begin_fill, end_fill, drawSquare, drawRectangle, drawCircle, drawDot, drawEllipse, drawPolygon, drawText
In addition, each function must satisfy its own requirements, as outlined below:
* When drawing a monster tail, the turtle will start off facing east at the top of the monster's back end.
* The tail should be drawn so that it touches the back end of the monster's body, which will generally extend at least 40-50 units south of the cursor's starting position. Stuff you draw to east of the starting position will overlap the monster body, so you should draw stuff to the west.
* By the time it's done, your monsterTail function must put the cursor back in the exact same spot it started at and leave the pen down.
* You are not allowed to use any absolute movement or orientation functions (like setposition, teleport, setheading, or realign) while drawing your monster tail, because doing so would prevent the tail from drawing correctly when positioned in different places.
* When drawing a monster body, the cursor will start at the upper-left corner of the body facing east, and the body should be drawn such that it extends about 100 units forward from the starting position, and about 50 units down. (the green monster does this using by drawing a 100x50 rectangle).
* Just as with monsterTail, the turtle must end up facing the same direction as when it started, but instead of leaving the turtle in the same place, it must move it exactly 100 units forward. That way, another body segment or a head can be drawn immediately afterwards.
* Using absolute movement or orientation functions is not allowed for the same reason as with monsterTail
* When drawing the monster head, the cursor will be positioned at the north-east corner of the body facing east.
* It should generally draw stuff to the east of this starting position, but it is not required to; whatever it draws will be drawn on top of the tail and body, since it gets called last.
* Just as with the tail and body, you may not use absolute movement commands in this function, and as with the tail, you must put the turtle back where it started before the function is done (in case someone wants to draw a second head, for example).
Once you are done with your monster piece functions, your next task is to combine them with the pieces of the green and/or yellow monsters to draw a monster with different parts mashed together. Your monsterMash function must not take any parameters and must obey the following rules:
* It must draw at least one tail, at least two bodies, and at least one head
* It must draw at least two different bodies (e.g., call greenBody and then monsterBody, or yellowBody and greenBody.
* It must NOT call pensize or call pencolor (the monster part functions must do this themselves).
Here is an example of how to put these monsters together:
Make sure that your file:
Starts with a comment indicating your name, the date, and any collaborators
Save your python file as LastnameFirstInitial_MonsterMash.py, e.g, this is how Beyoncé Knowles would name her file: bk134_hw3_monstermash.py
Each function has a docstring
Each function is tested properly
Submit this file in gradescope