-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Edward's RPS project #12
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#rock,#paper,#scissors { | ||
height: 100px; | ||
width: 100px; | ||
border: 20px; | ||
border-radius: 50px; | ||
} | ||
#rock { | ||
|
||
} | ||
#paper { | ||
|
||
} | ||
#scissors { | ||
|
||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<!DOCTYPE> | ||
<html> | ||
<head> | ||
<script src="https://code.jquery.com/jquery-2.1.4.js"></script> | ||
<title>Rock,Paper,Scissors</title> | ||
</head> | ||
<body> | ||
|
||
</body> | ||
</html> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. should be on a new line |
||
var compare = function(choice1,choice2) { | ||
if(userChoice === computerChoice) { | ||
return "The result is a tie!"; | ||
}; | ||
if(choice2 === "scissors") { | ||
return "scissors wins"; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Whenever you There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. regardless, the code in this code block needs to be indented. |
||
$('body').append("scissors wins"); | ||
} | ||
else { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. indent. make sure the rest of the function body is indented. |
||
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"); | ||
} | ||
}; | ||
}); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. overall this is definitely heading in the right direction 🎉. just make sure you keep your code neatly formatted to make it easier to read. For example, make sure to use indentation when appropriate (inside code blocks), and try to maintain an equal width of indentation (use the tab key on your keyboard instead of the spacebar) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice!