Advertisement
Guest User

Untitled

a guest
Jul 28th, 2015
267
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.76 KB | None | 0 0
  1. function p(){for(;z;){var t=prompt("Enter Rock, Paper, or Scissors to play!\nType 'Exit' or click 'Cancel' to quit.\n\n▬▬▬▬▬▬▬▬▬ஜ۩۞۩ஜ▬▬▬▬▬▬▬▬▬\n\nScoreboard\n\n• User wins: "+uW+"\n• Computer wins: "+cW+"\n\n"),e=o[Math.floor(Math.random()*o.length)],i=o.indexOf(e);if(vC(t)){t=t.toLowerCase();var n=o.indexOf(t);v(n,i),z=confirm("You chose "+t+", and the computer chose "+e+"!\n"+w)}}}var w="",uW=0,cW=0,txt="",z=!0,o=["paper","rock","scissors"],v=function(o,t){return o==t?void(w="It's a tie!"):t>o&&2!=(o||t)?(w="You win!",void uW++):o||2==t?2===o&&0===t?(w="You win!",void uW++):2==t&&0===o?(w="Computer wins!",void cW++):t>o?(w="You win!",void uW++):(w="Computer wins!",void cW++):void 0},vC=function(t){for(var e=!1;!e;){if(null===t||"exit"===t.toLowerCase()){console.log(t),e=!0,z=!1,alg(uW,cW);var i=uW/cW;return alert("You won: "+uW+" games\nThe computer won: "+cW+" games\nBy dividing your wins by the computer's, we get a value of:\n"+i+"\n\n"+txt),void console.log("Game ended")}return""===t?(alert("No input received."),e=!1,!1):o.indexOf(t.toLowerCase())<0?(alert("Invalid input."),e=!1,!1):(e=!0,!0)}},alg=function(o,t){var e=o/t;return isNaN(e)?(txt+="NaN stands for Not a Number, and since we can't divide 0 by 0, we get NaN.\nBaNaNa. NaNaNaNaNaNaN Batman. Thermal camera.",!1):isFinite(e)?1>e?e>=.5?void(txt+="How do you lose against a computer.."):void(txt+="How is it even possible to lose this much. Did even try?"):1==e?void(txt+="Why are you tied? Who likes being tied? Fix your shit next time."):e>1&&2>=e?void(txt+="You did good, but remember that this game is based on luck. Lucky bastard."):e>2?void(txt+="Oh wow. You are better than a computer at a shitty game. Congratulations bumbo."):void 0:(txt+="Well...shit",!0)};p();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement