+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/01week/rockPaperScissors.js b/01week/rockPaperScissors.js
index 16f58790a..f0477395d 100644
--- a/01week/rockPaperScissors.js
+++ b/01week/rockPaperScissors.js
@@ -1,3 +1,13 @@
+// Student: Jon Gorman
+// Class: 211 JavaScript Tue/Thur
+// Instructor: Renee Dudley
+// Date: 10/10/17
+//
+//Make a function for rock paper scissors game
+//function should include a way to check for a tie
+//function should include a way to check for player one win
+//function should include a way to check for player two win
+//function should have a way to check that game is played correctly i.e.(no use of words other tha those needed for game
'use strict';
const assert = require('assert');
@@ -8,10 +18,21 @@ const rl = readline.createInterface({
});
-function rockPaperScissors(hand1, hand2) {
-
- // Write code here
-
+function rockPaperScissors(a, b) {
+ // make variables that allow the function to pass the test ie. lowercase and whitespace.
+ const hand1 = a.toLowerCase().trim();
+ const hand2 = b.toLowerCase().trim();
+ //check for a tie
+ if (hand1 === hand2) {
+ return "It's a tie!";
+ // Write code here
+ // Check for hand one win
+ } else if (hand1 === 'rock' && hand2 === 'scissors' || hand1 === 'paper' && hand2 === 'rock' || hand1 === 'scissors' && hand2 === 'paper') {
+ return "Hand one wins!"
+ //Check for player two win
+ } else if (hand1 === 'rock' && hand2 === 'paper' || hand1 === 'paper' && hand2 === 'scissors' || hand1 === 'scissors' && hand2 === 'rock') {
+ return "Hand two wins!"
+ }
}
function getPrompt() {
@@ -49,3 +70,7 @@ if (typeof describe === 'function') {
getPrompt();
}
+//"good programmers look both ways before crossing one way street"
+//// else if (hand1 && hand2 !== 'rock', 'paper', 'scissors'){
+// return "\sYour tryig to play a different game!\s"
+// }
\ No newline at end of file