Question: need help turning my psuedo code into javascript code so i can make this game called Spaceman which the theme is The player must

need help turning my psuedo code into javascript code so i can make this game called Spaceman which the theme is " The player must lose after a certain number of wrong guesses."
5 wrong guesses and the player loses
- the player needs to guess the hidden word by guessing letters while having a limit to the number of guesses
- there is a list that has a certain number of words. A random word will be chosen and the player will have to guess the word
-Start Game
word_list ->["space","galaxy", "astronaut","planet"]
guessed_letters->[]
SET max_wrong_guesses =5
FUNCTION new_game()
SET Word = Random from word_list
ADD letter_guessed TO guessed_letter
SET wrong_guesses to 0
SET display_word to "_"* Length of word_to_guess
WHILE wrong_guesses < max_wrong_guessses And display_word Contains "_"
Display display_ word
Display "Guessed Letters: "+ guessed_letters
Display "Wrong guesses left: "+(max_wrong_guesses - wrong_guesses)
INPUT guess As character
If guess on guessed_letters
Display "YOU already guessed that letter."
Continue WHILE
Add guess to guessed_letters
If guess In word_to_guess
For each index, letter IN word_to_guess
FOR each index, Letter IN word_to_guess
IF letter == guess
Replace display_word[index] with guess
Else
INCREMENT wrong_guesses by 1
IF display_word DOES NOT CONTAIN "_"
Display "Congratulations! You've guessed the word:" + word_to_guess
Else
Display "Game Over! The word was:" + word_to_guess

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!