Skip to content

home work Rock, Paper, Scissors#8

Open
cuilhan wants to merge 1 commit into
hackyourfuturecanada:Umit-Ilhanfrom
cuilhan:master
Open

home work Rock, Paper, Scissors#8
cuilhan wants to merge 1 commit into
hackyourfuturecanada:Umit-Ilhanfrom
cuilhan:master

Conversation

@cuilhan
Copy link
Copy Markdown

@cuilhan cuilhan commented Sep 5, 2019

No description provided.

@epq
Copy link
Copy Markdown
Collaborator

epq commented Sep 12, 2019

@azizomarck Please leave some feedback for Umit!

Comment thread game.js
console.log("-------------------\nYou WIN! Congratulations\n-------------------");
} else if(playerWin < computerWin){
console.log("-------------------\nI am so sorry! Computer WIN!\n-------------------");
} else {
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

I like that you are handling this case

Comment thread game.js
const computerSelection = computerPlay().toUpperCase();
if(playerSelection === "ROCK" || playerSelection === "PAPER" || playerSelection === "SCISSORS"){
let result = playRound(playerSelection,computerSelection);
if(result.includes("WIN")){
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

others might disagree, but I would say it is not a reliable and the most efficient method to check for the winner.

Comment thread game.js
} else {
return `${computer === "PAPER" ?
`You WIN! \nYour Selection:${player} beats Computer Selection:${computer}` :
`You Lose! \nComputer Selection:${computer} beats Your Selection:${player}`}`;
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

It's cool that you used the ternary operator as the return value of your function, but I would suggest sticking with select statements only, esp because you have a long string in your ternary operator statements which hinder the readability of your code.

Comment thread game.js
// console.log('Hello, world!');

function computerPlay(){
const selections = ['rock', 'paper', 'scissors'];
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

I like that you have selection as a local variable, I should have done that too

Comment thread game.js
}
}

game();
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

overall, creative code, Great Job!

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Thank you all suggest. I will consider next time.

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.

3 participants