Functions: There’s a Name for That 149
the faces will begin at (0, 0). The command t.setpos(x-15, y+60) will
make sure that wherever our yellow face is being drawn, our left
eye will be in the upper left of that face.
The code to draw the right eye is almost identical to the
code for drawing the left eye. We can see that the right eye is
15 pixels (1.5 grid lines) to the right of our (x, y) location, and still
60 pixels up. The command t.setpos(x+15, y+60) should place the
eye symmetrically. Here’s the code for the right eye:
Right eye
t.setpos(x+15, y+60)
t.begin_fill()
t.circle(10)
t.end_fill()
The fill color is still blue from the left eye, so we just have to
set the turtle to the correct position (x+15, y+60), turn the fill on,
draw the eye, and finish filling it.
Drawing a mouth
Now let’s plan the most important part of the smiley face: the smile.
To make the smile simpler, we’re going to draw the mouth with just
three thick, black lines. The left side of the mouth looks like it starts
about 2.5 grid lines to the left of and 4 grid lines above our point
(x, y), so we’ll position the turtle at (x-25, y+40) to start drawing the
smile. We’ll set the pen color to black and the width to 10 so that
the smile is thick and easy to see. From the upper-left corner of the
smile, we need to go to (x-10, y+20), then to (x+10, y+20), and finally
to the upper-right corner of the smile at (x+25, y+40). Notice that