From 3621e5c102045a564c1a6c4415cef5e0109a1bbd Mon Sep 17 00:00:00 2001 From: Cris Smith Date: Sun, 13 Jan 2019 20:54:36 -0600 Subject: [PATCH 1/3] 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/3] 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(); + + } From f2337681a9c3965f1b8d66f32332a681a9596a79 Mon Sep 17 00:00:00 2001 From: Cris Smith Date: Thu, 17 Jan 2019 01:07:48 -0600 Subject: [PATCH 3/3] added pigLatin translator --- 02week/pigLatin.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/02week/pigLatin.js b/02week/pigLatin.js index 046434c94..508d661f9 100644 --- a/02week/pigLatin.js +++ b/02week/pigLatin.js @@ -7,12 +7,16 @@ const rl = readline.createInterface({ output: process.stdout }); +//added pigLatin code function pigLatin(word) { - // Your code here -} + word= word.toLowerCase(); + let vowels = word.search(/[aeiuo]/); + console.log(word.substring(vowels) + word.substring(0,vowels) + "ay") + } + pigLatin("car"); function getPrompt() {