From 073ea263936a9d6614d28a1cd4008f594e20eae0 Mon Sep 17 00:00:00 2001 From: priscillamartinez Date: Wed, 2 Dec 2020 19:55:25 -0600 Subject: [PATCH 01/10] update --- main.js | 21 +++++++++++++++++++++ package.json | 2 +- 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/main.js b/main.js index 72f0f1a8..18be97aa 100644 --- a/main.js +++ b/main.js @@ -15,6 +15,27 @@ const rl = readline.createInterface({ const rockPaperScissors = (hand1, hand2) => { // Write code here + if (hand1 === hand2){ + console.log("It's a Tie!"); + } else if (hand1 === 'rock'){ + if (hand2 === 'paper'){ + console.log("hand2 Wins!!"); + } else{ + console.log("hand1 Wins!!"); + } + } else if (hand1 === 'paper'){ + if (hand2 === 'rock'){ + console.log("hand1 Wins!!"); + } else { + console.log("hand2 Wins!!"); + } + } else{ + if(hand2 === 'rock'){ + console.log("hand2 Wins!!"); + } else{ + console.log("hand1 Wins!!"); + } + } // Use the unit test to see what is expected } diff --git a/package.json b/package.json index 09c5e8f1..eefd2ea0 100644 --- a/package.json +++ b/package.json @@ -22,7 +22,7 @@ "eslint": "^3.19.0", "functional-javascript-workshop": "^1.0.6", "htmllint-cli": "github:kevincolten/htmllint-cli", - "http-server": "^0.11.1", + "http-server": "^0.12.3", "javascripting": "^2.6.1", "jsdom": "^11.6.2", "mocha": "^5.0.0", From a9db0b64e1f8b357e1f2c58b1919c28bc45ea8d9 Mon Sep 17 00:00:00 2001 From: priscillamartinez Date: Wed, 2 Dec 2020 20:00:31 -0600 Subject: [PATCH 02/10] update --- main.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/main.js b/main.js index 18be97aa..63f26d82 100644 --- a/main.js +++ b/main.js @@ -16,24 +16,24 @@ const rockPaperScissors = (hand1, hand2) => { // Write code here if (hand1 === hand2){ - console.log("It's a Tie!"); + console.log("It's a tie!"); } else if (hand1 === 'rock'){ if (hand2 === 'paper'){ - console.log("hand2 Wins!!"); + console.log("Hand two wins!"); } else{ - console.log("hand1 Wins!!"); + console.log("Hand one wins!"); } } else if (hand1 === 'paper'){ if (hand2 === 'rock'){ - console.log("hand1 Wins!!"); + console.log("Hand one wins!"); } else { - console.log("hand2 Wins!!"); + console.log("Hand two wins!"); } } else{ if(hand2 === 'rock'){ - console.log("hand2 Wins!!"); + console.log("Hand two wins!"); } else{ - console.log("hand1 Wins!!"); + console.log("Hand one wins!"); } } // Use the unit test to see what is expected From 0ba5c0bf5faa46a27a054829202fd28b3621906c Mon Sep 17 00:00:00 2001 From: priscillamartinez Date: Wed, 2 Dec 2020 20:04:22 -0600 Subject: [PATCH 03/10] change --- main.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.js b/main.js index 63f26d82..6f3e09b8 100644 --- a/main.js +++ b/main.js @@ -16,7 +16,7 @@ const rockPaperScissors = (hand1, hand2) => { // Write code here if (hand1 === hand2){ - console.log("It's a tie!"); + return "It's a tie!"; } else if (hand1 === 'rock'){ if (hand2 === 'paper'){ console.log("Hand two wins!"); From e5a92df93d1f1e425e247bf1108e925f218d74fd Mon Sep 17 00:00:00 2001 From: priscillamartinez Date: Wed, 2 Dec 2020 20:05:40 -0600 Subject: [PATCH 04/10] changes --- main.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/main.js b/main.js index 6f3e09b8..1be572a4 100644 --- a/main.js +++ b/main.js @@ -19,21 +19,21 @@ const rockPaperScissors = (hand1, hand2) => { return "It's a tie!"; } else if (hand1 === 'rock'){ if (hand2 === 'paper'){ - console.log("Hand two wins!"); + return "Hand two wins!"; } else{ - console.log("Hand one wins!"); + return "Hand one wins!" } } else if (hand1 === 'paper'){ if (hand2 === 'rock'){ - console.log("Hand one wins!"); + return "Hand one wins!" } else { - console.log("Hand two wins!"); + return "Hand two wins!" } } else{ if(hand2 === 'rock'){ - console.log("Hand two wins!"); + return "Hand two wins!"; } else{ - console.log("Hand one wins!"); + return "Hand one wins!"; } } // Use the unit test to see what is expected From b52cb6fe1b6b8f37c76dc02c9b9094f9ba53a4f9 Mon Sep 17 00:00:00 2001 From: priscillamartinez Date: Wed, 2 Dec 2020 20:12:59 -0600 Subject: [PATCH 05/10] update --- main.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/main.js b/main.js index 1be572a4..f906f2d8 100644 --- a/main.js +++ b/main.js @@ -13,7 +13,8 @@ const rl = readline.createInterface({ // the function that will be called by the unit test below const rockPaperScissors = (hand1, hand2) => { - + hand1.trim(); + hand2.trim(); // Write code here if (hand1 === hand2){ return "It's a tie!"; From 51e605beb4e1653df8ac723f87e8b07cde577945 Mon Sep 17 00:00:00 2001 From: priscillamartinez Date: Wed, 2 Dec 2020 20:37:22 -0600 Subject: [PATCH 06/10] changes --- main.js | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/main.js b/main.js index f906f2d8..2ecdfca6 100644 --- a/main.js +++ b/main.js @@ -13,25 +13,24 @@ const rl = readline.createInterface({ // the function that will be called by the unit test below const rockPaperScissors = (hand1, hand2) => { - hand1.trim(); - hand2.trim(); + // Write code here - if (hand1 === hand2){ + if (hand1.trim() === hand2.trim()){ return "It's a tie!"; - } else if (hand1 === 'rock'){ - if (hand2 === 'paper'){ + } else if (hand1.trim() === 'rock'){ + if (hand2.trim() === 'paper'){ return "Hand two wins!"; } else{ return "Hand one wins!" } - } else if (hand1 === 'paper'){ - if (hand2 === 'rock'){ + } else if (hand1.trim() === 'paper'){ + if (hand2.trim() === 'rock'){ return "Hand one wins!" } else { return "Hand two wins!" } } else{ - if(hand2 === 'rock'){ + if(hand2.trim() === 'rock'){ return "Hand two wins!"; } else{ return "Hand one wins!"; From ff1bcbe21e8896d2e3a66f31a3cf000d693c5840 Mon Sep 17 00:00:00 2001 From: priscillamartinez Date: Wed, 2 Dec 2020 20:38:44 -0600 Subject: [PATCH 07/10] changes --- main.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/main.js b/main.js index 2ecdfca6..f3aedd26 100644 --- a/main.js +++ b/main.js @@ -15,22 +15,22 @@ const rl = readline.createInterface({ const rockPaperScissors = (hand1, hand2) => { // Write code here - if (hand1.trim() === hand2.trim()){ + if (hand1.trim().toLowerCase() === hand2.trim().toLowerCase()){ return "It's a tie!"; - } else if (hand1.trim() === 'rock'){ - if (hand2.trim() === 'paper'){ + } else if (hand1.trim().toLowerCase() === 'rock'){ + if (hand2.trim().toLowerCase() === 'paper'){ return "Hand two wins!"; } else{ return "Hand one wins!" } - } else if (hand1.trim() === 'paper'){ - if (hand2.trim() === 'rock'){ + } else if (hand1.trim().toLowerCase() === 'paper'){ + if (hand2.trim().toLowerCase() === 'rock'){ return "Hand one wins!" } else { return "Hand two wins!" } } else{ - if(hand2.trim() === 'rock'){ + if(hand2.trim().toLowerCase() === 'rock'){ return "Hand two wins!"; } else{ return "Hand one wins!"; From 0fd8f236b55b5e948795bdb84dd258c025976043 Mon Sep 17 00:00:00 2001 From: priscillamartinez Date: Sun, 6 Dec 2020 11:44:16 -0600 Subject: [PATCH 08/10] updates --- main.js | 36 ++++++++++++++++++++---------------- 1 file changed, 20 insertions(+), 16 deletions(-) diff --git a/main.js b/main.js index f3aedd26..d22c9ee6 100644 --- a/main.js +++ b/main.js @@ -13,40 +13,44 @@ const rl = readline.createInterface({ // the function that will be called by the unit test below const rockPaperScissors = (hand1, hand2) => { - + + // Write code here + hand1 = hand1.trim().toLowerCase(); + hand2 = hand2.trim().toLowerCase(); + // Write code here - if (hand1.trim().toLowerCase() === hand2.trim().toLowerCase()){ - return "It's a tie!"; - } else if (hand1.trim().toLowerCase() === 'rock'){ - if (hand2.trim().toLowerCase() === 'paper'){ - return "Hand two wins!"; + if (hand1 === hand2){ + return "It's a Tie!"; + } else if (hand1 === 'rock'){ + if (hand2 === 'paper'){ + return "hand2 Wins!!"; } else{ - return "Hand one wins!" + return "hand1 Wins!!"; } - } else if (hand1.trim().toLowerCase() === 'paper'){ - if (hand2.trim().toLowerCase() === 'rock'){ - return "Hand one wins!" + } else if (hand1 === 'paper'){ + if (hand2 === 'rock'){ + return "hand1 Wins!!"; } else { - return "Hand two wins!" + return "hand2 Wins!!"; } } else{ - if(hand2.trim().toLowerCase() === 'rock'){ - return "Hand two wins!"; + if(hand2 === 'rock'){ + return "hand2 Wins!!"; } else{ - return "Hand one wins!"; + return "hand1 Wins!!"; } } // Use the unit test to see what is expected - } + // the first function called in the program to get an input from the user // to run the function use the command: node main.js // to close it ctrl + C function getPrompt() { rl.question('hand1: ', (answer1) => { rl.question('hand2: ', (answer2) => { - console.log( rockPaperScissors(answer1, answer2) ); + console.log(rockPaperScissors(answer1, answer2)); getPrompt(); }); }); From cda0d4a59dbbff219cfb8b5350135cb2df4bcd5d Mon Sep 17 00:00:00 2001 From: priscillamartinez Date: Sun, 6 Dec 2020 11:46:48 -0600 Subject: [PATCH 09/10] updates --- main.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/main.js b/main.js index d22c9ee6..78b3ba51 100644 --- a/main.js +++ b/main.js @@ -23,21 +23,21 @@ const rockPaperScissors = (hand1, hand2) => { return "It's a Tie!"; } else if (hand1 === 'rock'){ if (hand2 === 'paper'){ - return "hand2 Wins!!"; + return "Hand two wins!"; } else{ - return "hand1 Wins!!"; + return "Hand one wins!"; } } else if (hand1 === 'paper'){ if (hand2 === 'rock'){ - return "hand1 Wins!!"; + return "Hand one wins!"; } else { - return "hand2 Wins!!"; + return "Hand two wins!"; } } else{ if(hand2 === 'rock'){ - return "hand2 Wins!!"; + return "Hand two wins!"; } else{ - return "hand1 Wins!!"; + return "Hand one wins!"; } } // Use the unit test to see what is expected From f957f6bee208620196c7a8d101f7166a638c26af Mon Sep 17 00:00:00 2001 From: priscillamartinez Date: Sun, 6 Dec 2020 11:47:38 -0600 Subject: [PATCH 10/10] small change --- main.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.js b/main.js index 78b3ba51..0bb4e358 100644 --- a/main.js +++ b/main.js @@ -20,7 +20,7 @@ const rockPaperScissors = (hand1, hand2) => { // Write code here if (hand1 === hand2){ - return "It's a Tie!"; + return "It's a tie!"; } else if (hand1 === 'rock'){ if (hand2 === 'paper'){ return "Hand two wins!";