From a6c6c786a9c3805d4e6bd1a152d7b5a900835b46 Mon Sep 17 00:00:00 2001 From: finthehuman Date: Wed, 21 Oct 2015 21:51:30 +0000 Subject: [PATCH] initial commit (file structure messed up) --- real_code/hello.css | 15 +++++++++++++++ real_code/hello.html | 10 ++++++++++ real_code/hello.js | 35 +++++++++++++++++++++++++++++++++++ 3 files changed, 60 insertions(+) create mode 100644 real_code/hello.css create mode 100644 real_code/hello.html create mode 100644 real_code/hello.js diff --git a/real_code/hello.css b/real_code/hello.css new file mode 100644 index 0000000..b81eeee --- /dev/null +++ b/real_code/hello.css @@ -0,0 +1,15 @@ +#rock,#paper,#scissors { + height: 100px; + width: 100px; + border: 20px; + border-radius: 50px; +} +#rock { + +} +#paper { + +} +#scissors { + +} \ No newline at end of file diff --git a/real_code/hello.html b/real_code/hello.html new file mode 100644 index 0000000..deffe87 --- /dev/null +++ b/real_code/hello.html @@ -0,0 +1,10 @@ + + + + + Rock,Paper,Scissors + + + + + \ No newline at end of file diff --git a/real_code/hello.js b/real_code/hello.js new file mode 100644 index 0000000..192e11d --- /dev/null +++ b/real_code/hello.js @@ -0,0 +1,35 @@ +$(document).ready(function(){ + var userChoice = prompt("Do you choose rock, paper or scissors?"); + var computerChoice = Math.random(); + + + +if (computerChoice < 0.34) { + computerChoice = "rock"; +} else if(computerChoice <= 0.67) { + computerChoice = "paper"; +} else { + computerChoice = "scissors"; +} console.log("Computer: " + computerChoice); +var compare = function(choice1,choice2) { + if(userChoice === computerChoice) { + return "The result is a tie!"; + }; + if(choice2 === "scissors") { + return "scissors wins"; + $('body').append("scissors wins"); +} +else { + return "paper wins"; + $('body').append("paper wins"); +} +if(choice2 === "scissors") { + return "rock wins"; + $('body').append("rock wins"); +} +else { + return "scissors wins"; + $("body").append("scissors wins"); +} +}; +}); \ No newline at end of file