Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Please help me to change assignment include 1. I need game must have at least si

ID: 3596040 • Letter: P

Question

Please help me to change assignment include 1. I need game must have at least six (6) different locations. 2. have to keep track of the player's location (a good use for a global variable) and use if or switch-case constructs to figure out where to go when processing the user's input. 3. Add a text input control in which the user can enter commands. Valid commands are cardinal directions: N, S, E, W, n, s, e, w 4.If the player enters an invalid command, then say so in the in the game's textarea, and explain the valid commands. My work <!DOCTYPE html>
<html> <head> <meta charset="utf-8"> <title> Life Game (T^T) </title> <Style> body { Background-color: #56b896; Background-size: 100% 100%; } </Style> </head> <body> <h1>Life Game (T^T) </h1> <script> function btnNorth() { document.getElementById("message").value="you cut through the courtyard, past the empty granite benches, where you'd met your lover!"; } function btnSouth() { document.getElementById("message").value="you lose your life by a accident"; } function btnEast() { document.getElementById("message").value="you get a lot of wealth, then you get the world"; } function btnWest() { document.getElementById("message").value="wake up , it is only a game"; } var score = 0; function Points() { score += 5; document.getElementById("myScore").innerHTML = score; } </script> <br/> <textarea readonly id="message" name="message" rows="50" cols="50"> If you do not choose, your life won’t advance, but here is only a game. </textarea> <br/> <button type="button">North</button> <button type="button">South</button> <button type="button">East</button> <button type="button">West</button> <br/> <p> Life is a game all people are players or prayers you want to attend the party please touch <a href="mailng1@mat.edu"> here.</p> <p2>Your score is <a id="myScore">0</a> points!</p2> Thanks Please help me to change assignment include 1. I need game must have at least six (6) different locations. 2. have to keep track of the player's location (a good use for a global variable) and use if or switch-case constructs to figure out where to go when processing the user's input. 3. Add a text input control in which the user can enter commands. Valid commands are cardinal directions: N, S, E, W, n, s, e, w 4.If the player enters an invalid command, then say so in the in the game's textarea, and explain the valid commands. My work <!DOCTYPE html>
<html> <head> <meta charset="utf-8"> <title> Life Game (T^T) </title> <Style> body { Background-color: #56b896; Background-size: 100% 100%; } </Style> </head> <body> <h1>Life Game (T^T) </h1> <script> function btnNorth() { document.getElementById("message").value="you cut through the courtyard, past the empty granite benches, where you'd met your lover!"; } function btnSouth() { document.getElementById("message").value="you lose your life by a accident"; } function btnEast() { document.getElementById("message").value="you get a lot of wealth, then you get the world"; } function btnWest() { document.getElementById("message").value="wake up , it is only a game"; } var score = 0; function Points() { score += 5; document.getElementById("myScore").innerHTML = score; } </script> <br/> <textarea readonly id="message" name="message" rows="50" cols="50"> If you do not choose, your life won’t advance, but here is only a game. </textarea> <br/> <button type="button">North</button> <button type="button">South</button> <button type="button">East</button> <button type="button">West</button> <br/> <p> Life is a game all people are players or prayers you want to attend the party please touch <a href="mailng1@mat.edu"> here.</p> <p2>Your score is <a id="myScore">0</a> points!</p2> Thanks Please help me to change assignment include 1. I need game must have at least six (6) different locations. 2. have to keep track of the player's location (a good use for a global variable) and use if or switch-case constructs to figure out where to go when processing the user's input. 3. Add a text input control in which the user can enter commands. Valid commands are cardinal directions: N, S, E, W, n, s, e, w 4.If the player enters an invalid command, then say so in the in the game's textarea, and explain the valid commands. My work <!DOCTYPE html>
<html> <head> <meta charset="utf-8"> <title> Life Game (T^T) </title> <Style> body { Background-color: #56b896; Background-size: 100% 100%; } </Style> </head> <body> <h1>Life Game (T^T) </h1> <script> function btnNorth() { document.getElementById("message").value="you cut through the courtyard, past the empty granite benches, where you'd met your lover!"; } function btnSouth() { document.getElementById("message").value="you lose your life by a accident"; } function btnEast() { document.getElementById("message").value="you get a lot of wealth, then you get the world"; } function btnWest() { document.getElementById("message").value="wake up , it is only a game"; } var score = 0; function Points() { score += 5; document.getElementById("myScore").innerHTML = score; } </script> <br/> <textarea readonly id="message" name="message" rows="50" cols="50"> If you do not choose, your life won’t advance, but here is only a game. </textarea> <br/> <button type="button">North</button> <button type="button">South</button> <button type="button">East</button> <button type="button">West</button> <br/> <p> Life is a game all people are players or prayers you want to attend the party please touch <a href="mailng1@mat.edu"> here.</p> <p2>Your score is <a id="myScore">0</a> points!</p2> <!DOCTYPE html>
<html> <head> <meta charset="utf-8"> <title> Life Game (T^T) </title> <Style> body { Background-color: #56b896; Background-size: 100% 100%; } </Style> </head> <body> <h1>Life Game (T^T) </h1> <script> function btnNorth() { document.getElementById("message").value="you cut through the courtyard, past the empty granite benches, where you'd met your lover!"; } function btnSouth() { document.getElementById("message").value="you lose your life by a accident"; } function btnEast() { document.getElementById("message").value="you get a lot of wealth, then you get the world"; } function btnWest() { document.getElementById("message").value="wake up , it is only a game"; } var score = 0; function Points() { score += 5; document.getElementById("myScore").innerHTML = score; } </script> <br/> <textarea readonly id="message" name="message" rows="50" cols="50"> If you do not choose, your life won’t advance, but here is only a game. </textarea> <br/> <button type="button">North</button> <button type="button">South</button> <button type="button">East</button> <button type="button">West</button> <br/> <p> Life is a game all people are players or prayers you want to attend the party please touch <a href="mailng1@mat.edu"> here.</p> <p2>Your score is <a id="myScore">0</a> points!</p2> Thanks

Explanation / Answer

<!DOCTYPE html>

<html>

<head>

<meta charset="utf-8">

<title> Life Game (T^T) </title>

<Style>

body {

Background-color: #56b896;

Background-size: 100% 100%;

}

</Style>

</head>

<body>

<h1>Life Game (T^T) </h1>

<script>

var score = 0;

function goToLocation(){

var command=document.getElementById("userinputcommand").value;

//Valid commands are cardinal directions: N, S, E, W, n, s, e, w

if( command=="N" || command=="n"){

document.getElementById("message").value="you cut through the courtyard, past the empty granite benches, where you'd met your lover!";

}else if(command=="S" || command=="s"){

document.getElementById("message").value="you lose your life by a accident";

}else if(command=="E" || command=="e"){

document.getElementById("message").value="you get a lot of wealth, then you get the world";

}else if(command=="W" || command=="w"){

document.getElementById("message").value="wake up , it is only a game";

}else{

document.getElementById("message").value="Enter command '"+command+"' is not valid command.";

}

score += 5;

document.getElementById("myScore").innerHTML = score;

}

</script>

<br/>

<textarea readonly id="message" name="message" rows="20" cols="50"> If you do not choose, your life won’t advance, but here is only a game.

</textarea>

<br/>

<div>

<input type="text" name="userinputcommand" id="userinputcommand" />

<button type="button">Go To Location</button>

</div>

<br/>

<p> Life is a game all people are players or prayers you want to attend the party please touch <a href="mailng1@mat.edu"> here.</a></p>

<h3>Your score is <span id="myScore">0</span> points!</h3>

</body>

</html>