This is a single-player game. Your assignment is to implement in ARM assembler (remember not to autogenerate the assembly code from C) the classic hangman game as we described during lecture. Make up a dictionary text file as we did in class and have your program randomly choose a word from the file as the keyword for the user to guess. The player then guesses a letter that they think may appear in the word. The computer checks whether the letter appears in the word and either reveals all instances of it (if it exists) or takes away one point from the player's lives (this is equivalent to spelling the word H-A-N-G-M-A-N one letter at a time for each guess in which the guessed letter does not appear in the keyword). The computer then displays (somehow) the progress that the player has made towards guessing the word. I would recommend that you display the letters that have been correctly guessed in the correct location and dashes in the location where the letters have not been guessed. Also display all the letters that have been guessed up to that point as well as spell out the letters in the word "HANGMAN" based on how many bad guesses have been made. If the user made 2 bad guesses, then print out "HA", if the user made 4 bad guesses, then print out "HANG", etc... The game continues until either all of the letters have been guessed (and the player wins) or all of the player's lives are used up (the entire word HANGMAN has been spelled out). In either case, the computer should announce this event and the game should end.
Here is an example dialog. Words in parentheses are provided for clarity and do not need to show up in your actual output:
(computer picks the word "fireball" from the dictionary file)
Computer: Human: r Computer: Letters guessed: r Number of lives lost:
Human: a
Computer: ra
Letters guessed: ra
Number of lives lost:
Human: L
Computer:

Letters guessed: r a l
Number of lives lost:
Human: h
Computer: r all
Letters guessed: r al h
Number of lives lost: H
Human: f
Computer: f r
all Letters guessed: r a lh f
Number of lives lost: H
Human: e
Computer: f re
all Letters guessed: r alhfe
Number of lives lost: H
Human: i
Computer: fire all
Letters guessed: r a lh fei
Number of lives lost: H
Human: b
Computer: fireball h
Letters guessed: r a lhfeih
Number of lives lost: H
Computer says "Congratulations! You figured out my word in 9 guesses and had 3 lives left!"
When you turn in your lab, make sure to include the output screenshot AND the dictionary.txt file that you used so that I can run it as is.



Answer :

Other Questions