Uploaded by Abhiram Edala

7VZYU9U7 WR

advertisement
3. WRITTEN RESPONSES
3 a.
3.a.i.
The purpose of the program is to allow a user to experience a hangman game. The purpose is to allow users to possibly
improve their vocabulary and spelling skills by guessing letters to reveal the hidden word.
3.a.ii.
It demonstrated the generation of a random word for the user to guess, keeping track of the number of incorrect guesses
as the hangman develops a new body part for every incorrect guess. It demonstrated the game starting over when the
start over button was clicked.
3.a.iii.
The input was the guessing letters of the word, I clicked on the letters that I was guessing and it was inputted into the
program. The output was either an extra body party attached to the hangman when I guessed wrong or my guess was
correct and the correct letters were placed in the word for the user to see.
3 b.
3.b.i.
3.b.ii.
3.b.iii.
The name of the list being used in the program is wordList.
3.b.iv.
The data contained in the list is the list of words that are used to be chosen as the word that the user is supposed to
guess. The function to randomly generate words uses the wordList to randomly choose words from for the user to guess.
3.b.v.
My code could not have been written, because the word chosen for every round is a random word chosen from that list,
and if there is no list a word cannot be generated. I could do this differently if I chose a different list or made my own list
by writing it out. The purpose of a hangman game is for a word to be chosen for the user to guess. I suppose I could
make it two-player and one use inputs a word for the other user to guess.
3 c.
3.c.i.
3.c.ii.
3.c.iii.
The first procedure uses the random word generated to display the number of open spaces the word has for the user to
guess. In the game the number of dashes represents the number of letters and when a letter is guessed the letter should
appear instead of the dash in the appropriate spaces.
3.c.iv.
The procedure works by pulling the random word that was generated and using a loop when substituting the dashes for
the letters so the number of letters corresponds to the number of dashes. Then there is a conditional statement to
substitute the letter back in if guessed by the user correctly.
3 d.
3.d.i.
First call:
One call is it sets wordList to a random word.
Second call:
Another call is the var numb being set equal to random number of the list.
3 d.ii.
Condition(s) tested by first call:
It must be part of the list.
Condition(s) tested by second call:
It must correspond to number on list.
3.d.iii.
Results of the first call:
This sets the specific word of the round to be the random word that was generated.
Results of the second call:
The result is it sets the random number to be used to determine the random word as the random number corresponds to
a certain random word.
Download