Hangman Phase 1

hangman

Over the last two days, we spent time reviewing Python strings so that we could create a Hangman game. With those string tools in place, we’ll begin to implement our game in phases.  For Phase 1, we want to implement nine drawing functions, which we will use to draw the entire body of our “guy”, Charlie.

So, the requirements for Phase 1 are:

  • Create a function drawHead() to draw Charlie’s head.
  • Create a function drawBody() to draw Charlie’s torso.
  • Create a function drawLeftArm() to draw Charlie’s left arm.
  • Create a function drawRightArm() to draw Charlie’s right arm.
  • Create a function drawRightLeg() to draw Charlie’s right leg.
  • Create a function drawLeftLeg() to draw Charlie’s left leg.
  • Create a function drawRightEye() to draw Charlie’s right eye.
  • Create a function drawLeftEye() to draw Charlie’s left eye.
  • Create a function drawFrown() to draw Charlie’s frown mouth.

If you get this accomplished, Phase 1 is done.  Below you will find the structure of a program, that includes code to test your functions.  Feel free to use it.

# yourname-hangman.py
# This program implements a Hangman Game.

import turtle

# *********************************************
# Function Definitions
# *********************************************
# **** Put your drawing functions definitions here ****

# *********************************************
# Main Program Code To Test Your Functions
# *********************************************
alex = turtle.Turtle()
wn = turtle.Screen()
drawHead(alex)
drawBody(alex)
drawLeftArm(alex)
drawRightArm(alex)
drawLeftLeg(alex)
drawRightLeg(alex)
drawLeftEye(alex)
drawRightEye(alex)
drawFrown(alex)

wn.exitonclick()

Now that this is done, our next task will be to add a function to draw the platform.  We’ll call it drawPlatform(). Stay tuned…