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.
The omit
function takes in a word and a letter and returns the same word with every occurence of the letter omitted (left out).
omit: string(word) string(letter) -> string
(check-expect (omit "word" "w") "ord")
(check-expect (omit "hangman" "a") "hngmn")
(check-expect (omit "nothing" "z") "nothing")
Follow the design process to write the omit
function.
Run your checks after each step to make sure you stay on track.
The wipeout
function takes in a word and a string of letters to
remove. Every occurence of the letters should be removed from the word.
wipeout: string(word) string(letters) -> string
(check-expect (wipeout "Williams" "li") "Wams")
(check-expect (wipeout "penguin" "dinosaur") "peg")
Follow the design process and use the omit
helper function!