Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Language: Javascript 2. Word Guesser (3 points) You'll create a simple word guessing game where the user gets infinite tries to guess the word (like
Language: Javascript
2. Word Guesser (3 points) You'll create a simple word guessing game where the user gets infinite tries to guess the word (like Hangman without the hangman, or like Wheel of Fortune without the wheel and fortune). Create two global arrays: one to hold the letters of the word (e.g. 'F', 'O', 'X'), and one to hold the current guessed letters (e.g. it would start with '_;!;!' and end with 'F', 'O', 'X'). Write a function called guessLetter that will: Take one argument, the guessed letter. 0 Iterate through the word letters and see if the guessed letter is in there. o If the guessed letter matches a word letter, changed the guessed letters array to reflect that. When it's done iterating, it should log the current guessed letters ('F__!) o and congratulate the user if they found a new letter. O It should also figure out if there are any more letters that need to be guessed, o and if not, it should congratulate the user for winning the game. Pretend you don't know the word, and call guessLetter multiple times with various letters to check that your program works. Bonus: Make it more like Wheel of Fortune: (1 point) o Start with a reward amount of $0 O Every time a letter is guessed, generate a random amount and reward the user if they found a letter (multiplying the reward if multiple letters found), otherwise subtract from their reward. o When they guess the word, log their final reward amount. 2. Word Guesser (3 points) You'll create a simple word guessing game where the user gets infinite tries to guess the word (like Hangman without the hangman, or like Wheel of Fortune without the wheel and fortune). Create two global arrays: one to hold the letters of the word (e.g. 'F', 'O', 'X'), and one to hold the current guessed letters (e.g. it would start with '_;!;!' and end with 'F', 'O', 'X'). Write a function called guessLetter that will: Take one argument, the guessed letter. 0 Iterate through the word letters and see if the guessed letter is in there. o If the guessed letter matches a word letter, changed the guessed letters array to reflect that. When it's done iterating, it should log the current guessed letters ('F__!) o and congratulate the user if they found a new letter. O It should also figure out if there are any more letters that need to be guessed, o and if not, it should congratulate the user for winning the game. Pretend you don't know the word, and call guessLetter multiple times with various letters to check that your program works. Bonus: Make it more like Wheel of Fortune: (1 point) o Start with a reward amount of $0 O Every time a letter is guessed, generate a random amount and reward the user if they found a letter (multiplying the reward if multiple letters found), otherwise subtract from their reward. o When they guess the word, log their final reward amount Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started