Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var outcomes= { "rock": "scissors", "scissors": "paper", "paper": "rock" };
- console.log ("REBEL ONE!")
- var myInput= prompt("Choose your weapon");
- if (Object.keys(outcomes) .indexOf(myInput.toLowerCase()) > -1)
- {
- var aiInput= Object.keys(outcomes) [Math.floor((Math.random() * 3) + 1) - 1];
- console.log ("AI chooses %s", aiInput);
- if (myInput==aiInput){
- console.log ("It's a tie, you both fucked up!");
- }
- else {
- if (outcomes [myInput] == aiInput) {
- console.log ("Victory!"); }
- else {
- console.log("AI Wins!"); }
- }
- }
- else {
- console.log ("You fucked up at rock, paper, scissors. What are you a programmer? Your mother must be so proud!"); }
Advertisement
Add Comment
Please, Sign In to add comment