Created
December 13, 2012 07:29
-
-
Save munro/4274777 to your computer and use it in GitHub Desktop.
rock papa sizzas
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var choice1 = prompt("Do you choose rock, paper or scissors?"); | |
var choice2 = Math.random(); | |
if (choice2 <0.34){ | |
choice2 = "rock"; | |
}else if(choice2 <=0.67){ | |
choice2 = "paper"; | |
}else{ | |
choice2 = "scissors"; | |
} | |
var compare = function (choice1,choice2) | |
if (choice1 = choice2){ | |
console.log("The result is a tie!"); | |
}; | |
if (choice1 = rock) { | |
if (choice2 === "paper") { | |
returns("paper wins"); | |
} else{ | |
returns("scissors win"); | |
}; | |
} | |
if (choice1 = paper) { | |
if (choice2 = "rock"){ | |
returns("paper wins"); | |
}else{ | |
returns("scissors win"); | |
} | |
} | |
if (choice1 = scissors) { | |
if (choice2 = "paper"){ | |
returns("paper wins"); | |
}else{ | |
returns("Sissors win"); | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment