From 3621e5c102045a564c1a6c4415cef5e0109a1bbd Mon Sep 17 00:00:00 2001 From: Cris Smith Date: Sun, 13 Jan 2019 20:54:36 -0600 Subject: [PATCH 1/2] added Rock Paper Scissors game codee --- 01week/rockPaperScissors.js | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/01week/rockPaperScissors.js b/01week/rockPaperScissors.js index 16f58790a..faf067c52 100644 --- a/01week/rockPaperScissors.js +++ b/01week/rockPaperScissors.js @@ -10,9 +10,32 @@ const rl = readline.createInterface({ function rockPaperScissors(hand1, hand2) { - // Write code here - + // Rock paper Scissors function, below: + + if (hand1 === hand2){ + console.log("It's a tie.") + }; + if (hand1 === 'rock' && hand2 === 'scissor') { + console.log("User1 wins.") + }; + if (hand1 ==='rock'&& hand2 === 'paper'){ + console.log("User2 wins.") + }; + if (hand1 === 'paper'&& hand2 === 'rock') { + console.log("User1 wins.") + }; + if (hand1 === 'paper' && hand2 === 'scissors'){ + console.log("User2 wins.") + }; + if (hand1 === 'scissors' && hand2 === 'paper'){ + console.log("User1 wins.") + }; + if (hand1 === 'scissors'&& hand2 === 'rock'){ + console.log("User2 wins.") + }; } +rockPaperScissors("rock","paper"); + function getPrompt() { rl.question('hand1: ', (answer1) => { From 74b40cb58a71f95ea213af1f20997ac785eb592b Mon Sep 17 00:00:00 2001 From: Cris Smith Date: Tue, 15 Jan 2019 18:37:58 -0600 Subject: [PATCH 2/2] added rps game --- 01week/rockPaperScissors.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/01week/rockPaperScissors.js b/01week/rockPaperScissors.js index faf067c52..9e6a6e4be 100644 --- a/01week/rockPaperScissors.js +++ b/01week/rockPaperScissors.js @@ -71,4 +71,6 @@ if (typeof describe === 'function') { getPrompt(); + + }