From 7e43b09a8bc0bd3bfc4c4c621ea9b6161395a8ed Mon Sep 17 00:00:00 2001 From: gormangit Date: Thu, 5 Oct 2017 18:14:59 -0500 Subject: [PATCH 01/14] :party: new branch --- 01week/datatypes.js | 1 + 1 file changed, 1 insertion(+) diff --git a/01week/datatypes.js b/01week/datatypes.js index a258c5235..3e48fa307 100644 --- a/01week/datatypes.js +++ b/01week/datatypes.js @@ -120,6 +120,7 @@ //use an if statement telling program what to console.log('true') if either of the varaibles are true //use blank else statement so the function sudo-stops. //call the function +//blablablabla // var pizza = 1; // var beer = 1; From 808b5e0cf79ab26d15c29b9d72599ba03c46c396 Mon Sep 17 00:00:00 2001 From: gormangit Date: Thu, 5 Oct 2017 20:22:43 -0500 Subject: [PATCH 02/14] RPS --- 01week/rockPaperScissors.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/01week/rockPaperScissors.js b/01week/rockPaperScissors.js index 16f58790a..e5cd88e79 100644 --- a/01week/rockPaperScissors.js +++ b/01week/rockPaperScissors.js @@ -9,7 +9,11 @@ const rl = readline.createInterface({ function rockPaperScissors(hand1, hand2) { - +console.log() +//check for a tie +if (hand1 === hand2){ + return "It's a Tie" +} // Write code here } From fe650517627119e84441e1296a579d925fd256d4 Mon Sep 17 00:00:00 2001 From: gormangit Date: Thu, 5 Oct 2017 20:27:20 -0500 Subject: [PATCH 03/14] RPS1 --- 01week/datatypes.js | 1 - 1 file changed, 1 deletion(-) diff --git a/01week/datatypes.js b/01week/datatypes.js index 3e48fa307..a258c5235 100644 --- a/01week/datatypes.js +++ b/01week/datatypes.js @@ -120,7 +120,6 @@ //use an if statement telling program what to console.log('true') if either of the varaibles are true //use blank else statement so the function sudo-stops. //call the function -//blablablabla // var pizza = 1; // var beer = 1; From fa51bcaf9651ab4c8972acb8b70b83ec40dae3da Mon Sep 17 00:00:00 2001 From: gormangit Date: Fri, 6 Oct 2017 09:26:12 -0500 Subject: [PATCH 04/14] save --- .idea/inspectionProfiles/Project_Default.xml | 7 + .idea/javascript-workbook.iml | 12 ++ .idea/misc.xml | 6 + .idea/modules.xml | 8 + .idea/vcs.xml | 6 + .idea/workspace.xml | 180 +++++++++++++++++++ 01week/rockPaperScissors.js | 20 ++- 7 files changed, 232 insertions(+), 7 deletions(-) create mode 100644 .idea/inspectionProfiles/Project_Default.xml create mode 100644 .idea/javascript-workbook.iml create mode 100644 .idea/misc.xml create mode 100644 .idea/modules.xml create mode 100644 .idea/vcs.xml create mode 100644 .idea/workspace.xml diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml new file mode 100644 index 000000000..db8c7d583 --- /dev/null +++ b/.idea/inspectionProfiles/Project_Default.xml @@ -0,0 +1,7 @@ + + + + \ No newline at end of file diff --git a/.idea/javascript-workbook.iml b/.idea/javascript-workbook.iml new file mode 100644 index 000000000..24643cc37 --- /dev/null +++ b/.idea/javascript-workbook.iml @@ -0,0 +1,12 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 000000000..28a804d89 --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,6 @@ + + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 000000000..316e76d3b --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 000000000..94a25f7f4 --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/.idea/workspace.xml b/.idea/workspace.xml new file mode 100644 index 000000000..0a1359b7d --- /dev/null +++ b/.idea/workspace.xml @@ -0,0 +1,180 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + false + + false + false + true + + + true + DEFINITION_ORDER + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -132,6 +153,14 @@ + + + + + + + + @@ -147,21 +176,21 @@ - - + - + - + @@ -185,10 +214,10 @@ - + - - + + @@ -197,18 +226,34 @@ - - + + - + - - + + + + + + + + + + + + + + + + + + From 97a9becc4990652a4a8f3c997b10eab7cc8df6ec Mon Sep 17 00:00:00 2001 From: gormangit Date: Tue, 10 Oct 2017 19:10:00 -0500 Subject: [PATCH 07/14] :pizza: corrections --- .idea/workspace.xml | 85 ++++++++++++++++++++----------------- 01week/rockPaperScissors.js | 24 ++++++----- 2 files changed, 59 insertions(+), 50 deletions(-) diff --git a/.idea/workspace.xml b/.idea/workspace.xml index dea6799da..8cfefa42f 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -1,7 +1,10 @@ - + + + + @@ -14,11 +17,11 @@ - + - - + + @@ -26,8 +29,8 @@ - - + + @@ -36,18 +39,6 @@ - - - - - - - - - - - - @@ -63,8 +54,9 @@ @@ -87,10 +79,9 @@ - @@ -153,11 +144,17 @@ - + + + + + + - - + + + @@ -176,21 +173,21 @@ - - + - + - + - + @@ -224,25 +221,33 @@ - + + + + + + + + + - - + + - + - + - + @@ -250,10 +255,10 @@ - + - - + + diff --git a/01week/rockPaperScissors.js b/01week/rockPaperScissors.js index 58f17501c..e86ca181f 100644 --- a/01week/rockPaperScissors.js +++ b/01week/rockPaperScissors.js @@ -17,22 +17,25 @@ const rl = readline.createInterface({ output: process.stdout }); -var Player1 = "Hand1 Wins!!"; -var Plaer2 = "Hand2 Wins!!"; -var result = Player1.fontcolor("green"); -var result1 = Plaer2.fontcolor("orange"); -function rockPaperScissors(hand1, hand2) { + +function rockPaperScissors(a, b) { //check for a tie + const hand1 = a.toLowerCase().trim(); + + const hand2 = b.toLowerCase().trim(); + + if(hand1 === hand2){ - return '\x1b[5m\x1b[31mIts a Tie\nYou need to redo the turn! \x1b[0m'; + return "It's a tie!"; // Write code here }else if(hand1 === 'rock' && hand2 === 'scissors' || hand1 === 'paper' && hand2 === 'rock' || hand1 === 'scissors' && hand2 === 'paper'){ - return '\x1b[32m\x1b[32mHand1 Wins! \x1b[0m' + return "Hand one wins!" }else if (hand1 === 'rock' && hand2 === 'paper' || hand1 === 'paper' && hand2 === 'scissors' || hand1 === 'scissors' && hand2 === 'rock'){ - return '\x1b[34mHand2 Wins!\x1b[0m' - }else if (hand1 && hand2 !== 'rock', 'paper', 'scissors'){ - return '\x1b[4mYour tryig to play a different game!\x1b[0m' + return "Hand two wins!" } + // else if (hand1 && hand2 !== 'rock', 'paper', 'scissors'){ + // return "\sYour tryig to play a different game!\s" + // } } function getPrompt() { rl.question('hand1: ', (answer1) => { @@ -69,3 +72,4 @@ if (typeof describe === 'function') { getPrompt(); } +//"good programmers look both ways before crossing one way street" \ No newline at end of file From 0e9d1e9ec9002e24799e63a27db7847b57852aa1 Mon Sep 17 00:00:00 2001 From: gormangit Date: Tue, 10 Oct 2017 22:43:08 -0500 Subject: [PATCH 08/14] latest revision --- .idea/misc.xml | 2 +- .idea/workspace.xml | 53 +++++++++++++++++++++++-------------- 01week/rockPaperScissors.js | 33 ++++++++++++----------- 3 files changed, 51 insertions(+), 37 deletions(-) diff --git a/.idea/misc.xml b/.idea/misc.xml index 28a804d89..24eb271ab 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -1,6 +1,6 @@ - \ No newline at end of file diff --git a/.idea/workspace.xml b/.idea/workspace.xml index 8cfefa42f..6cad44af8 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -2,6 +2,7 @@ + @@ -17,11 +18,11 @@ - + - - + + @@ -29,6 +30,16 @@ + + + + + + + + + + @@ -65,10 +76,10 @@ - false + true false - false + true true @@ -79,7 +90,8 @@ - @@ -131,6 +143,9 @@ + + + - - + @@ -229,16 +244,6 @@ - - - - - - - - - - @@ -257,13 +262,21 @@ - - + + + + + + + + + + \ No newline at end of file diff --git a/01week/rockPaperScissors.js b/01week/rockPaperScissors.js index e86ca181f..f0477395d 100644 --- a/01week/rockPaperScissors.js +++ b/01week/rockPaperScissors.js @@ -19,24 +19,22 @@ const rl = readline.createInterface({ function rockPaperScissors(a, b) { -//check for a tie + // make variables that allow the function to pass the test ie. lowercase and whitespace. const hand1 = a.toLowerCase().trim(); - const hand2 = b.toLowerCase().trim(); - - - if(hand1 === hand2){ - return "It's a tie!"; - // Write code here - }else if(hand1 === 'rock' && hand2 === 'scissors' || hand1 === 'paper' && hand2 === 'rock' || hand1 === 'scissors' && hand2 === 'paper'){ - return "Hand one wins!" - }else if (hand1 === 'rock' && hand2 === 'paper' || hand1 === 'paper' && hand2 === 'scissors' || hand1 === 'scissors' && hand2 === 'rock'){ - return "Hand two wins!" - } - // else if (hand1 && hand2 !== 'rock', 'paper', 'scissors'){ - // return "\sYour tryig to play a different game!\s" - // } + //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() { rl.question('hand1: ', (answer1) => { rl.question('hand2: ', (answer2) => { @@ -72,4 +70,7 @@ if (typeof describe === 'function') { getPrompt(); } -//"good programmers look both ways before crossing one way street" \ No newline at end of file +//"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 From 1c37f1f3f766a155b51d1950a15210a185a23bab Mon Sep 17 00:00:00 2001 From: gormangit Date: Thu, 12 Oct 2017 16:46:12 -0500 Subject: [PATCH 09/14] added test & added .idea to ignore --- .gitignore | 1 + 02week/tests.js | 67 +++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 68 insertions(+) diff --git a/.gitignore b/.gitignore index ed9495781..ff41a6aaa 100644 --- a/.gitignore +++ b/.gitignore @@ -8,3 +8,4 @@ npm-debug.log* # OS artifacts *.DS_Store +.idea diff --git a/02week/tests.js b/02week/tests.js index e69de29bb..c0813c37b 100644 --- a/02week/tests.js +++ b/02week/tests.js @@ -0,0 +1,67 @@ +'use strict'; + +const assert = require('assert'); +const readline = require('readline'); +const rl = readline.createInterface({ + input: process.stdin, + output: process.stdout +}); + + +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!" + }else if (hand1 && hand2 !== 'rock', 'paper', 'scissors'){ + return "You are not playing the game!" +} +} + +function getPrompt() { + rl.question('hand1: ', (answer1) => { + rl.question('hand2: ', (answer2) => { + console.log( rockPaperScissors(answer1, answer2) ); + getPrompt(); + }); + }); +} + +// Tests + +if (typeof describe === 'function') { + describe('#rockPaperScissors()', () => { + it('should detect a tie', () => { + assert.equal(rockPaperScissors('rock', 'rock'), "It's a tie!"); + assert.equal(rockPaperScissors('paper', 'paper'), "It's a tie!"); + assert.equal(rockPaperScissors('scissors', 'scissors'), "It's a tie!"); + }); + it('should detect which hand won', () => { + assert.equal(rockPaperScissors('rock', 'paper'), "Hand two wins!"); + assert.equal(rockPaperScissors('paper', 'scissors'), "Hand two wins!"); + assert.equal(rockPaperScissors('scissors', 'rock'), "Hand two wins!") + assert.equal(rockPaperScissors('rock', 'scissors'), "Hand one wins!"); + }); + it('should scrub input to ensure lowercase with "trim"ed whitepace', () => { + assert.equal(rockPaperScissors('rOcK', ' paper '), "Hand two wins!"); + assert.equal(rockPaperScissors('Paper', 'SCISSORS'), "Hand two wins!"); + assert.equal(rockPaperScissors('rock ', 'sCiSsOrs'), "Hand one wins!"); + }); + it('shoulde check for unassigned words', () => { + assert.notEqual(rockPaperScissors('rock, paper, scissors', 'rock, paper, scissors'), "You are not playing the game!"); + }); + }); +} else { + + getPrompt(); + +} \ No newline at end of file From d34b0bc97b2dc1b776f260b7e84a6927b63a912b Mon Sep 17 00:00:00 2001 From: gormangit Date: Fri, 13 Oct 2017 08:53:43 -0500 Subject: [PATCH 10/14] initial homework on tests :coffee: --- .idea/workspace.xml | 297 ++++++++++++++++++++++++++++++++++++-------- 02week/tests.js | 7 ++ 2 files changed, 249 insertions(+), 55 deletions(-) diff --git a/.idea/workspace.xml b/.idea/workspace.xml index 6cad44af8..eeaa16d16 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -2,9 +2,8 @@ - - + @@ -17,34 +16,22 @@ - - - + + + - - - - - - - - - - - - - - + + - - + + - - + + @@ -68,6 +55,7 @@ @@ -90,11 +78,12 @@ - + @@ -110,6 +99,22 @@ + + + + + + + + + + + + + + - @@ -188,30 +187,29 @@ - - - + - + - - - - - + + + + - - - + + + - - + + + @@ -226,32 +224,217 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - + + + + + + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -264,9 +447,6 @@ - - - @@ -274,6 +454,13 @@ + + + + + + + diff --git a/02week/tests.js b/02week/tests.js index c0813c37b..d5b54ca89 100644 --- a/02week/tests.js +++ b/02week/tests.js @@ -1,3 +1,7 @@ +//student:Jon Gorman +//Assignment: Tests in rockPaperScissors +//Instructor: Reneee Dudley +//Date: 10/13/2017 'use strict'; const assert = require('assert'); @@ -12,6 +16,7 @@ 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!"; @@ -50,6 +55,8 @@ if (typeof describe === 'function') { assert.equal(rockPaperScissors('paper', 'scissors'), "Hand two wins!"); assert.equal(rockPaperScissors('scissors', 'rock'), "Hand two wins!") assert.equal(rockPaperScissors('rock', 'scissors'), "Hand one wins!"); + assert.equal(rockPaperScissors('scissors', 'paper'), "Hand one wins!"); + assert.equal(rockPaperScissors('paper', 'rock'), "Hand one wins!"); }); it('should scrub input to ensure lowercase with "trim"ed whitepace', () => { assert.equal(rockPaperScissors('rOcK', ' paper '), "Hand two wins!"); From a0236820928d85f4ec2303ba3cf1f36ef46fe409 Mon Sep 17 00:00:00 2001 From: gormangit Date: Fri, 13 Oct 2017 09:13:50 -0500 Subject: [PATCH 11/14] checking if git stash wrks --- 02week/tests.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/02week/tests.js b/02week/tests.js index d5b54ca89..993e0d7c1 100644 --- a/02week/tests.js +++ b/02week/tests.js @@ -28,7 +28,7 @@ function rockPaperScissors(a, b) { } else if (hand1 === 'rock' && hand2 === 'paper' || hand1 === 'paper' && hand2 === 'scissors' || hand1 === 'scissors' && hand2 === 'rock') { return "Hand two wins!" }else if (hand1 && hand2 !== 'rock', 'paper', 'scissors'){ - return "You are not playing the game!" + return "You are not playing the game right!" } } @@ -64,7 +64,7 @@ if (typeof describe === 'function') { assert.equal(rockPaperScissors('rock ', 'sCiSsOrs'), "Hand one wins!"); }); it('shoulde check for unassigned words', () => { - assert.notEqual(rockPaperScissors('rock, paper, scissors', 'rock, paper, scissors'), "You are not playing the game!"); + assert.notEqual(rockPaperScissors('rock, paper, scissors', 'rock, paper, scissors'), "You are not playing the game right!"); }); }); } else { From 39558875c22faaba4aa548b0deca2257bfce1144 Mon Sep 17 00:00:00 2001 From: gormangit Date: Sun, 15 Oct 2017 13:57:09 -0500 Subject: [PATCH 12/14] another test --- .idea/workspace.xml | 179 +++++++++++++++++++++++++++++++++++--------- 02week/tests.js | 3 +- 2 files changed, 146 insertions(+), 36 deletions(-) diff --git a/.idea/workspace.xml b/.idea/workspace.xml index eeaa16d16..40a28f9f4 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -2,7 +2,6 @@ - @@ -16,22 +15,22 @@ - - - + + + - - + + - - + + - - + + @@ -99,6 +98,7 @@ + @@ -127,11 +127,15 @@ + + + + + + @@ -191,20 +219,19 @@ - - - + - + - + @@ -213,17 +240,17 @@ + - - + @@ -305,7 +332,9 @@ - + + + @@ -313,7 +342,6 @@ - @@ -329,7 +357,9 @@ - + + + @@ -337,7 +367,9 @@ - + + + @@ -545,32 +577,40 @@ - - + + + + + + - - - + + + + + - - + + - - - + + + + + diff --git a/02week/tests.js b/02week/tests.js index 5842b5ab8..dae6ec38c 100644 --- a/02week/tests.js +++ b/02week/tests.js @@ -28,7 +28,7 @@ function rockPaperScissors(a, b) { //Check for player two win } else if (hand1 === 'rock' && hand2 === 'paper' || hand1 === 'paper' && hand2 === 'scissors' || hand1 === 'scissors' && hand2 === 'rock') { return "Hand two wins!" - }else if (hand1 && hand2 !== 'rock', 'paper', 'scissors'){ + }else { return "You are not playing the game right!" } } @@ -65,7 +65,9 @@ if (typeof describe === 'function') { assert.equal(rockPaperScissors('rock ', 'sCiSsOrs'), "Hand one wins!"); }); it('shoulde check for unassigned words', () => { - assert.notEqual(rockPaperScissors('rock, paper, scissors', 'rock, paper, scissors'), "You are not playing the game right!"); + assert.equal(rockPaperScissors('rock', 'pippir'), "You are not playing the game right!"); + assert.equal(rockPaperScissors('roiok', 'paper'), "You are not playing the game right!"); + assert.equal(rockPaperScissors('roiock', 'pippir'), "You are not playing the game right!"); }); }); } else { From 40678c00eb8f7096a35230b47eb2c2340f1d1bd8 Mon Sep 17 00:00:00 2001 From: gormangit Date: Tue, 24 Oct 2017 17:23:45 -0500 Subject: [PATCH 14/14] newest --- 02week/tests.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/02week/tests.js b/02week/tests.js index dae6ec38c..ec485ea23 100644 --- a/02week/tests.js +++ b/02week/tests.js @@ -67,7 +67,7 @@ if (typeof describe === 'function') { it('shoulde check for unassigned words', () => { assert.equal(rockPaperScissors('rock', 'pippir'), "You are not playing the game right!"); assert.equal(rockPaperScissors('roiok', 'paper'), "You are not playing the game right!"); - assert.equal(rockPaperScissors('roiock', 'pippir'), "You are not playing the game right!"); + assert.equal(rockPaperScissors('roiock', 'poppir'), "You are not playing the game right!"); }); }); } else {