Skip to content

scissors paper stone basics 11-5#344

Open
sinyuenn wants to merge 2 commits intorocketacademy:mainfrom
sinyuenn:main
Open

scissors paper stone basics 11-5#344
sinyuenn wants to merge 2 commits intorocketacademy:mainfrom
sinyuenn:main

Conversation

@sinyuenn
Copy link

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

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

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

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?

Comfort Level (1-5):3

Completeness Level (1-5):3

What did you think of this deliverable?could be better

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

Copy link

@Ennnm Ennnm left a comment

Choose a reason for hiding this comment

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

well done, control flow is quite clear, used functions to rollScissorPaperStone.
could try using more functions in the future to further simplify code in the main function ⭐

Comment on lines +2 to +16
var rollScissorPaperStone = function () {
var randomDecimal = Math.random() * 3;
var randomInteger = Math.floor(randomDecimal);
var signRolled = 0;
if (randomInteger == 0) {
signRolled = `scissors`;
}
if (randomInteger == 1) {
signRolled = `paper`;
}
if (randomInteger == 2) {
signRolled = `stone`;
}
return signRolled;
};
Copy link

Choose a reason for hiding this comment

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

gd job abstracting this out into a function

const signs = [`scissors`, `paper`, `stone`];
var gamesCount = 0;
var userWonCount = 0;
var CompWonCount = 0;
Copy link

Choose a reason for hiding this comment

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

should follow camel-case convention just like your other variables

return signRolled;
};

const signs = [`scissors`, `paper`, `stone`];
Copy link

Choose a reason for hiding this comment

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

Nice trying this out in advance, could have been used for assigning signedRolled in rollScissorsPaper stone function

var main = function (input) {
var myOutputValue = 'hello world';
var randomSign = rollScissorPaperStone();
console.log(`computer generated ${randomSign}`);
Copy link

Choose a reason for hiding this comment

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

good use of console logs

var myOutputValue = 'hello world';
var randomSign = rollScissorPaperStone();
console.log(`computer generated ${randomSign}`);
var myOutputValue = `Uh oh, I cannot read your message. <br>
Copy link

Choose a reason for hiding this comment

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

input validation 👍

Comment on lines +31 to +35
if (input == randomSign) {
gamesCount += 1;
drawCount += 1;
myOutputValue = `You chose ${input}. <br> The computer chose ${randomSign}. <br> You drawed ${drawCount} times. <br> Type "scissors" "paper" or "stone" to play another round!`;
}
Copy link

Choose a reason for hiding this comment

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

good job figuring this out

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