Authors: Renee Lau, Jerry Chan, Jason Huang
What is the problem?
We will implement the classic guessing game of Hangman.
| / \
In this single player game, you are given a random phrase where all letters are hidden. The goal is to guess a letter at a time to fill in the phrase. If a letter appears more than once in the phrase, all occurrences will be filled out. Each guess that is incorrect, your hangman is 1 step closer to death. After a limited number of incorrect guesses, you will lose. If you fill in the phrase successfully, you win.
What is the something extra?
Our extra aspect is a hint function to help the player.
When the player is stuck and does not want to waste a life with an incorrect guess, they can ask for a hint from the computer. In doing so, one letter and all its occurrences are filled in. This does not consume any lives. If the word is filled in completely after this hint, the player still wins.
What did we learn from doing this?
- We learned that backslash needs to be escaped in order to show as a string.
- We struggled with generating random numbers but we ultimately learned how to do it (by importing System.Random, etc).
- We learned that commenting in Haskell is really important, particularly with types.