22a. Hangman Project

The game of hangman a classic guess-the-word game. You can try hangman online, but do not play too long - just learn the rules.

Check in

  • Illustrations and model.
  • Key handler and logic helper function: (string-contains-letter? str letter).
  • Draw handler and define/contract (if discussed in class).
  • Completed project.

Steps

  • 22a. Hangman Outline
  • Outline of everything to do for hangman project.

  • 22a. Hangman Images
  • How to load a sequence of images into DrRacket.

  • 22a. Hangman Key Handler
  • Every keypress is a guess - adjust the model accordingly.

  • 22a. Hangman DH Warmup
  • The key step is to draw the word with underscores for the letters missed. This page will not include any specific advice on how to draw the word with underscores for the letters that are not guessed. The wipeout function below should provide you will all of the skills you need to do it, though. Underscore Warmup I: omit The omit function takes in a word and a letter and returns the same word with every occurence of the letter omitted (left out).

  • 22a. Hangman Draw Handler
  • Draw the whole scene by using helper functions to draw the different parts. At first you can just put all of the images above each other; later you can change the placement so it looks the way you prefer. Draw the gallows based on how many wrong answers. Draw the mistaken letters. Draw the word with underscores for letters that are not guessed. The key step is to draw the word with underscores for the letters missed.