COMP 141: Project 3

Potato Heads

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.

What you need to do

Important

Remember that your drawing functions should not assume the location of the circle for the face is at one fixed location! This means that the proper locations of the hair, mouth, and eyes that you are drawing must be calculated based off of centerx and centery. This will involve doing some math. For instance, if you want to draw circles for eyes that are to the left and right of the center point of the face, you would do something like draw_circle(centerx - 50, centery, 10) for the left eye and draw_circle(centerx + 50, centery, 10) for the right eye. That way, if the center of the circle changes to a different location, the eyes will also shift locations accordingly.

Start with this code

You should use the following program structure: (Yes, literally copy it into a blank Python program)
# Name: 
# Date: 
# Class: 
# Project: 
# Pledge: 
# Description: 

from simplegraphics import *

# Draw the eyes on a potato of radius 150 pixels.
# Parameters: (centerx, centery), the (x, y) coordinates of the potato center.
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.
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.
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(1000, 500)

    # Draw the left potato:
    # Draw a potato-colored circle, centered at (250, 250).
    set_color_rgb(224, 144, 76)
    draw_filled_circle(250, 250, 150)
    set_color("black")
    
    # Draw the features of the left potato.  Reset the color back to black
    # between calls.
    draw_eyes(250, 250)
    set_color("black")
    draw_hair(250, 250)
    set_color("black")
    draw_mouth(250, 250)
    
    # Draw the right potato:
    # Draw a potato-colored circle, centered at (750, 250).
    set_color_rgb(224, 144, 76)
    draw_filled_circle(750, 250, 150)
    set_color("black")
    
    # Draw the features of the right potato.  Reset the color back to black
    # between calls.
    draw_eyes(750, 250)
    set_color("black")
    draw_hair(750, 250)
    set_color("black")
    draw_mouth(750, 250)    
    
    close_canvas_after_click()

main()

Testing your program

Because everyone's program will create different pictures, I can't tell you exactly what the output should look like. However, you should definitely see two identical potatoes side by side.

Grading

You will not be graded on artistic ability, however you will be graded on perceived effort. In order to receive a good grade on this project, you should use multiple drawing functions, multiple colors, and your functions should be multiple lines long.

For a "B", you should use at least three colors, three different drawing commands, and the total number of lines within your three functions (for eyes, hair, and mouth) should be at least 15 lines of code.

For an "A", you should use at least five colors, five different drawing commands, and the total number of lines within your three functions (for eyes, hair, and mouth) should be at least 25 lines of code.

If you are struggling to come up with things to draw for all the colors, commands, and lines of code, you may think outside the box for the eyes, hair and mouth by including other common things people wear in those general facial areas. For instance, for hair, you may include a hat or something else people wear on their head or in their hair. For eyes, you can include glasses, eyebrows, eyelashes, or something else people wear near their eyes. For the mouth, you can draw facial hair, teeth, lips, or other similar things.

Submission