From ac520af2de892c83ee84c3f049bbe36a6fa9065c Mon Sep 17 00:00:00 2001 From: ramyaravikumar22 Date: Wed, 7 Sep 2022 00:27:16 -0500 Subject: [PATCH 1/3] saving progress --- main.js | 22 +++++++++++++++++++--- package.json | 14 +++++++------- 2 files changed, 26 insertions(+), 10 deletions(-) diff --git a/main.js b/main.js index e98b0914..1d2c7578 100644 --- a/main.js +++ b/main.js @@ -1,4 +1,4 @@ -// uses strict mode so strings are not coerced, variables are not hoisted, etc... +;// uses strict mode so strings are not coerced, variables are not hoisted, etc... 'use strict'; // brings in the assert module for unit testing @@ -9,10 +9,26 @@ const readline = require('readline'); const rl = readline.createInterface({ input: process.stdin, output: process.stdout -}); +}); // not original and that is added to get the inout output - Ramya // the function that will be called by the unit test below -const rockPaperScissors = (hand1, hand2) => { +const rockPaperScissors = (h1, h2) => { +const hand1 = h1.toLowerCase().trim() +const hand2 = h2.toLowerCase().trim() + + if (hand1 == hand2) { + return "It's a tie!" + } + + if (hand1 == "rock" && hand2 == "paper") { + return "Hand two wins!" + } else if (hand1 == "paper" && hand2 == "scissors"){ + return "Hand two wins!" + } else if (hand1 == "rock" && hand2 == "scissors"){ + return "Hand one wins!" + } + + // Write code here // Use the unit test to see what is expected diff --git a/package.json b/package.json index 09c5e8f1..3c9aae17 100644 --- a/package.json +++ b/package.json @@ -19,14 +19,14 @@ }, "homepage": "https://github.com/AustinCodingAcademy/JS211_RockPaperScissorsProject#readme", "dependencies": { - "eslint": "^3.19.0", - "functional-javascript-workshop": "^1.0.6", + "eslint": "^8.23.0", + "functional-javascript-workshop": "^0.0.23", "htmllint-cli": "github:kevincolten/htmllint-cli", - "http-server": "^0.11.1", - "javascripting": "^2.6.1", - "jsdom": "^11.6.2", - "mocha": "^5.0.0", + "http-server": "^14.1.1", + "javascripting": "^2.4.0", + "jsdom": "^20.0.0", + "mocha": "^10.0.0", "postcss-html": "^0.34.0", - "stylelint": "^7.13.0" + "stylelint": "^14.11.0" } } From 4a8a8819e63812e86aa2d1fb22698c321a226aa3 Mon Sep 17 00:00:00 2001 From: ramyaravikumar22 Date: Wed, 7 Sep 2022 00:44:00 -0500 Subject: [PATCH 2/3] saving changes --- main.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/main.js b/main.js index 1d2c7578..d561eb70 100644 --- a/main.js +++ b/main.js @@ -16,15 +16,15 @@ const rockPaperScissors = (h1, h2) => { const hand1 = h1.toLowerCase().trim() const hand2 = h2.toLowerCase().trim() - if (hand1 == hand2) { + if (h1 == h2) { return "It's a tie!" } - if (hand1 == "rock" && hand2 == "paper") { + if (h1 == "rock" && h2 == "paper") { return "Hand two wins!" - } else if (hand1 == "paper" && hand2 == "scissors"){ + } else if (h1 == "paper" && h2 == "scissors"){ return "Hand two wins!" - } else if (hand1 == "rock" && hand2 == "scissors"){ + } else if (h1 == "rock" && h2 == "scissors"){ return "Hand one wins!" } @@ -41,7 +41,7 @@ const hand2 = h2.toLowerCase().trim() function getPrompt() { rl.question('hand1: ', (answer1) => { rl.question('hand2: ', (answer2) => { - console.log( rockPaperScissors(answer1, answer2) ); + console.log(rockPaperScissors(answer1, answer2)); getPrompt(); }); }); From 2be384ec81e66be07dcc83d2274610486e7f066f Mon Sep 17 00:00:00 2001 From: ramyaravikumar22 Date: Wed, 4 Jan 2023 19:58:25 -0600 Subject: [PATCH 3/3] main.js --- main.js | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/main.js b/main.js index d561eb70..a36f16fa 100644 --- a/main.js +++ b/main.js @@ -9,25 +9,26 @@ const readline = require('readline'); const rl = readline.createInterface({ input: process.stdin, output: process.stdout -}); // not original and that is added to get the inout output - Ramya +}); // the function that will be called by the unit test below const rockPaperScissors = (h1, h2) => { -const hand1 = h1.toLowerCase().trim() -const hand2 = h2.toLowerCase().trim() - - if (h1 == h2) { + const hand1 = h1.toLowerCase().trim() + const hand2 = h2.toLowerCase().trim() + if (hand1 == hand2) { return "It's a tie!" } - - if (h1 == "rock" && h2 == "paper") { + if (hand1 == "rock" && hand2 == "paper") { return "Hand two wins!" - } else if (h1 == "paper" && h2 == "scissors"){ - return "Hand two wins!" - } else if (h1 == "rock" && h2 == "scissors"){ - return "Hand one wins!" - } - + } + + else if (hand1 == "paper" && hand2 == "scissors"){ + return "Hand two wins!" + } + + else if (hand1 == "rock" && hand2 == "scissors"){ + return "Hand one wins!" + } // Write code here