Assigned: Friday, September 16
Due: Thursday, September 22, 2016 by 11:55pm (on Moodle)
Description
The potato head toy is a children's toy that consists of a plastic potato-shaped model to which children stick different facial features such as eyes, noses, mouths, hair, ears, etc. Originally, children used actual potatoes rather than the plastic potato.In this project, you will re-create this experience with functions by designing a program that creates a potato model with eyes, hair, and a mouth. Once everyone has completed the project, we will combine all the projects together to make potatoes that use features from multiple people's code at once.
All of the potatoes are represented by circles of radius 150. Your job is to write functions that draw eyes, hair, and mouth on a potato. However, your functions must be designed so that the potato can be placed anywhere on the screen --- to that end, your functions should all take two parameters called centerx and centery, which represent the center of the potato-circle where the facial features should be drawn. In other words, each of your functions must calculate the correct placement of the facial features based on the centerx and centery parameters.
# Name: FILL IN # Project: Potato Heads # Pledge: I have neither given nor received unauthorized aid on this program. # Description: FILL IN # Input: FILL IN # Output: FILL IN from simplegraphics import * # Draw the eyes on a potato of radius 150 pixels. # Parameters: (centerx, centery), the (x, y) coordinates of the potato center. # Returns: None def draw_eyes(centerx, centery): # Remove this print statement when writing this function. print("Drawing eyes.") # Draw the hair on a potato of radius 150 pixels. # Parameters: (centerx, centery), the (x, y) coordinates of the potato center. # Returns: None def draw_hair(centerx, centery): # Remove this print statement when writing this function. print("Drawing hair.") # Draw the mouth on a potato of radius 150 pixels. # Parameters: (centerx, centery), the (x, y) coordinates of the potato center. # Returns: None def draw_mouth(centerx, centery): # Remove this print statement when writing this function. print("Drawing mouth.") # The program starts here. # *** DO NOT CHANGE ANY OF THE CODE IN MAIN. *** def main(): open_canvas(800, 400) # Draw the left potato: # Draw a potato-colored circle, centered at (200, 200). set_color_rgb(224, 144, 76) draw_filled_circle(200, 200, 150) set_color("black") # Draw the features of the left potato. draw_eyes(200, 200) draw_hair(200, 200) draw_mouth(200, 200) # Draw the right potato: # Draw a potato-colored circle, centered at (600, 200). set_color_rgb(224, 144, 76) draw_filled_circle(600, 200, 150) set_color("black") # Draw the features of the right potato. draw_eyes(600, 200) draw_hair(600, 200) draw_mouth(600, 200) close_canvas_after_click() main()
Your program will be graded on correctness, as well as on coding style, which refers to choices you make when writing your code, such as good use of variable names, appropriate indentation, a
nd comments (this is not an exhaustive list). See the syllabus for further grading details.
You will receive one bonus point for every complete day your program is turned in early, up to a maximum of five points. For instance, if your program is due on September 20 at 11:59pm, if you turn in your code on Moodle any time on September 19 from 12:00am through 11:59pm, you will receive one extra point on your project. Programs submitted on September 18 from 12:00am through
11:59pm will receive two points. This pattern continues for up to five points.