Wednesday, October 3rd at 11:59pm
In this project, you will be making an iOS application for the Hangman game. Users should be able to:
- start a game,
- make guesses for a phrase (list of phrases provided),
- see their progress toward the phrase, see a list of previously guessed incorrect letters,
- see how many guesses they have left (indicated by a hangman image - basic images provided),
- be alerted of a win or loss, and
- start a new game.
Though we do not have many requirements for this project, you are encouraged to customize your app. Here's a screenshot from a past project submission for some inspiration:
To submit, add your hw2 folder to a private repository. You can find detailed instructions on how to add your assignment to a repo here.
We have provided you code to interact with the list of locations in Berkeley (see HangmanPhrases.swift), but you will implement the rest of the features on your own. Add the following code to your code to generate a random word (where you decide to add these lines is up to you!).
let hangmanPhrases = HangmanPhrases()
// Generate a random phrase for the user to guess
let phrase: String = hangmanPhrases.getRandomPhrase()
print(phrase)
We've also provided some images for you to use in the Assets.xcassets folder (they're so boring though - you're encouraged to make your own!)
You must create the following two files to pass the autograder (and to preserve MVC!).
- HangmanViewController.swift - subclass of UIViewController
- HangmanGame.swift - model class for your game
- a
UILabel
that displays the "_"s corresponding to each word in the provided puzzle string
- a
UILabel
that lists the incorrect guesses thus far - a
UITextField
(where the user enters a letter as a guess). Users should only be able to guess one letter at a time. If you decide to create a custom keyboard, this is not required - a "Guess"
UIButton
that will update the game state based on the guessed letter - if that letter appears in the puzzle string, the corresponding "_" should be replaced by the correctly guessed letter
- if that letter does not appear in the puzzle string, that letter should be added to the label from the second bullet point to keep track of "Incorrect Guesses: ", and the Hangman image should update to represent the number of incorrect guesses
- a
UIImageView
that represents the "state" of the Hangman, with appropriate images for each "state"
- a win state alert (example) with an action titled "New Game" that restarts the game after being pressed.
- a game over state alert (no action requirement - feel free to do what you find best)
- a "Start Over" button in the main interface, which starts a new game
- A smart way for the user to guess letters (since a TextField for letter entry isn't ideal UX).
- Customized design, including, but not limited to, custom images for the Hangman states
- Anything else that you think will impress us or you think would be fun to implement!
If you complete all of the required features you will get full credit. We will deduct points for missing features, bugs, and UI layout issues. If you impress us with additional features (see the Optional Features section), you may be awarded an additional extra credit point.
- hw2 folder and contents
- a simulator screenshot of your app (on any orientation / device). Include this in your hw2 folder.
Please submit by compressing your hw2 folder into a zip file and uploading this to Gradescope.