var adventurersName = ["George", " Tim", " Sarah", " Mike", " Edward"]; var adventurersKilled = 3; var survivors; var leader = "Captain Thomas King"; var numberOfAdventurers = adventurersName.length; survivors = numberOfAdventurers - adventurersKilled; console.log("Welcome to The God Among Us\n"); console.log("A group of adventurers began their search for the mystical god said to live among us. In charge of the squad was " + leader + " who was famous for his past exploits. Along the way, the group of comrades were attacked by the god's loyal followers. The adventurers fought with bravado and strength under the tutelage of "+ leader + " the followers were defeated but they still suffered great losses. After a headcount of the remaining squad, "+ adventurersKilled +" were found to be dead which left only " + survivors + " remaining survivors.\n"); console.log("Current Statistics :\n"); console.log("Total Adventurers = " + numberOfAdventurers); console.log("Total Killed = " + adventurersKilled); console.log("Total Survived = " + survivors); const prompt = require('prompt-sync')(); var user_life = 3; var correct_answer = "2" var userIsCorrect; var options = ["\nOption 1 Enter the village hut?","Option 2 Eat the turkey leg?","Option 3 Sit on the stool?","Option 4 Talk with the shadowy figure?\n"]; var leader = prompt("Enter Leader Name: ") while (user_life>0) { user_life = game(leader,options); if (user_life === 0) { var play_again = prompt("Do You Want Play Again (y/n)? "); if (play_again =="y") { user_life = 3 var leader = prompt("Enter Leader Name:") } else { console.log(` Game Ended! Bye!`) break; } } } function game(leader,options) { showOptions(options); const input = prompt("Enter Your choice (Number) "); userIsCorrect = (input == correct_answer); if (userIsCorrect) { console.log("Yay, you picked the right option. You rest a day and come to a new village that looks exactly the same. Which option do you choose?"); }else{ user_life= user_life-1; console.log("One Life is Lost!") } displayStats(user_life,leader); return user_life; } function showOptions(option) { console.log(option[0]); console.log(option[1]); console.log(option[2]); console.log(option[3]); } function displayStats(user_life,name) { console.log(` Current Statistics: Leader Name: ${name} Lives Remaining: ${user_life}`) console.log("Adventurers in your party = " + survivors); }   What needs to be changed in the Notepad++ code for the correct answers to be 1, 2 and 3 instead of just 2? Also, How do I get "Game ended, Bye to show up without closing the cmd?

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

var adventurersName = ["George", " Tim", " Sarah", " Mike", " Edward"];
var adventurersKilled = 3;
var survivors;
var leader = "Captain Thomas King";
var numberOfAdventurers = adventurersName.length;

survivors = numberOfAdventurers - adventurersKilled;

console.log("Welcome to The God Among Us\n");
console.log("A group of adventurers began their search for the mystical god said to live among us. In charge of the squad was " + leader + " who was famous for his past exploits. Along the way, the group of comrades were attacked by the god's loyal followers. The adventurers fought with bravado and strength under the tutelage of "+ leader + " the followers were defeated but they still suffered great losses. After a headcount of the remaining squad, "+ adventurersKilled +" were found to be dead which left only " + survivors + " remaining survivors.\n");

console.log("Current Statistics :\n");
console.log("Total Adventurers = " + numberOfAdventurers);
console.log("Total Killed = " + adventurersKilled);
console.log("Total Survived = " + survivors);


const prompt = require('prompt-sync')();
var user_life = 3;
var correct_answer = "2"
var userIsCorrect;
var options = ["\nOption 1 Enter the village hut?","Option 2 Eat the turkey leg?","Option 3 Sit on the stool?","Option 4 Talk with the shadowy figure?\n"];


var leader = prompt("Enter Leader Name: ")

while (user_life>0) {
user_life = game(leader,options);

if (user_life === 0) {
var play_again = prompt("Do You Want Play Again (y/n)? ");

if (play_again =="y") {
user_life = 3
var leader = prompt("Enter Leader Name:")

} else {
console.log(`
Game Ended!
Bye!`)
break;
}
}
}

function game(leader,options) {

showOptions(options);


const input = prompt("Enter Your choice (Number) ");

userIsCorrect = (input == correct_answer);

if (userIsCorrect) {
console.log("Yay, you picked the right option. You rest a day and come to a new village that looks exactly the same. Which option do you choose?");
}else{
user_life= user_life-1;
console.log("One Life is Lost!")
}
displayStats(user_life,leader);

return user_life;

}

function showOptions(option) {
console.log(option[0]);
console.log(option[1]);
console.log(option[2]);
console.log(option[3]);

}

function displayStats(user_life,name) {
console.log(`
Current Statistics:
Leader Name: ${name}
Lives Remaining: ${user_life}`)
console.log("Adventurers in your party = " + survivors);

}

 

What needs to be changed in the Notepad++ code for the correct answers to be 1, 2 and 3 instead of just 2? Also, How do I get "Game ended, Bye to show up without closing the cmd?

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps with 1 images

Blurred answer
Knowledge Booster
Class
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education