Skip to content

SPS2 editted#359

Open
GeoBanico wants to merge 1 commit into
rocketacademy:mainfrom
GeoBanico:main
Open

SPS2 editted#359
GeoBanico wants to merge 1 commit into
rocketacademy:mainfrom
GeoBanico:main

Conversation

@GeoBanico

Copy link
Copy Markdown

Please fill out the survey before submitting the pull request. Thanks!

🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀

How many hours did you spend on this assignment? 2-3hrs

Please fill in one error and/or error message you received while working on this assignment.

What part of the assignment did you spend the most time on? the game mode

Comfort Level (1-5): 4

Completeness Level (1-5): 4

What did you think of this deliverable? it is fair

Is there anything in this code that you feel pleased about? the game mode

What's one aspect of your code you would like specific, elaborate feedback on? none

@gcskhor gcskhor left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

appropriately named variables and comments made your code easy to understand. Overall, very well done!

Comment thread script.js
Comment on lines +160 to +214
if (gameMode_Current == gameMode_Name) {
userName = input;
gameMode_Current = gameMode_GameSel; //change game mode to game select
return `Welcome ${userName}. <br><br>
Please select a gamemode: <br>
-type 'rps' for Rock-Paper-Scissors<br>
-type 'rev' for reverse Rock-Paper-Scissors`;
} else {
if (gameMode_Current == gameMode_GameSel) {
if (input.toLowerCase() == "rps") {
gameMode_Current = gameMode_RPS;
return "Game Mode: Rock-Paper-Scissors<br> Type r|rock, p|paper, s|scissors";
} else if (input.toLowerCase() == "rev") {
gameMode_Current = gameMode_Reverse;
return "Game Mode: Reverse Rock-Paper-Scissors<br> Type r|rock, p|paper, s|scissors";
} else
return `Hi ${userName}, please enter a game mode. <br>
-type 'rps' for Rock-Paper-Scissors<br>
-type 'rev' for reverse Rock-Paper-Scissors`;
}
//game proper
else {
//game mode: change name
if (input.toLowerCase() == "name") {
gameMode_Current = gameMode_Name;
return `Game Mode: Naming<br>
Please Enter your name.`;
}
//game mode: change mode to rps
else if (input.toLowerCase() == "rps") {
if (gameMode_Current == gameMode_RPS)
return `Game Mode is already Rock-Paper-Scissors.<br>
Type r|rock, p|paper, s|scissors`;

gameMode_Current == gameMode_RPS;
return `Game Mode: Game Select<br>
Please Enter your game. <br>
-type 'rps' for Rock-Paper-Scissors<br>
-type 'rev' for reverse Rock-Paper-Scissors`;
}
//game mode: change mode to reverse
else if (input.toLowerCase() == "rev") {
if (gameMode_Current == gameMode_Reverse)
return `Game Mode is already Reverse Rock-Paper-Scissors.<br>
Type r|rock, p|paper, s|scissors`;

gameMode_Current == gameMode_Reverse;
return `Game Mode: Game Select<br>
Please Enter your game. <br>
-type 'rps' for Rock-Paper-Scissors<br>
-type 'rev' for reverse Rock-Paper-Scissors`;
}
//continue game
else return rpsGame(input);
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You could also attempt the more advanced switch statement for a cleaner game mode selection in the main function:
https://www.w3schools.com/js/js_switch.asp

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants