From 6589faef4896a00fdd84288ffddf946a607fc115 Mon Sep 17 00:00:00 2001 From: "Glitch (xbc30ep450-a2-shortstack)" Date: Sun, 8 Sep 2019 03:41:32 +0000 Subject: [PATCH 01/46] =?UTF-8?q?=F0=9F=8E=AB=E2=8F=B1=20Checkpoint?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- shrinkwrap.yaml | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 shrinkwrap.yaml diff --git a/shrinkwrap.yaml b/shrinkwrap.yaml new file mode 100644 index 00000000..86c7048d --- /dev/null +++ b/shrinkwrap.yaml @@ -0,0 +1,15 @@ +dependencies: + mime: 2.4.4 +packages: + /mime/2.4.4: + dev: false + engines: + node: '>=4.0.0' + hasBin: true + resolution: + integrity: sha512-LRxmNwziLPT828z+4YkNzloCFC2YM4wrB99k+AV5ZbEyfGNWfG8SO1FUXLmLDBSo89NrJZ4DIWeLjy1CHGhMGA== +registry: 'https://registry.npmjs.org/' +shrinkwrapMinorVersion: 9 +shrinkwrapVersion: 3 +specifiers: + mime: ^2.4.4 From a54d10c6f4f059dd16fadb40b76dddf45b607fb8 Mon Sep 17 00:00:00 2001 From: "Glitch (xbc30ep450-a2-shortstack)" Date: Sun, 8 Sep 2019 04:03:44 +0000 Subject: [PATCH 02/46] =?UTF-8?q?=F0=9F=91=9B=F0=9F=91=A8=E2=80=8D?= =?UTF-8?q?=F0=9F=91=A8=E2=80=8D=F0=9F=91=A6=20Checkpoint=20./server.impro?= =?UTF-8?q?ved.js:2480790/256?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server.improved.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/server.improved.js b/server.improved.js index 26673fc0..cdbd1859 100644 --- a/server.improved.js +++ b/server.improved.js @@ -38,9 +38,11 @@ const handlePost = function( request, response ) { }) request.on( 'end', function() { - console.log( JSON.parse( dataString ) ) + var obj = JSON.parse( dataString ) + console.log( obj ) // ... do something with the data here!!! + console.log(obj.yourname) response.writeHead( 200, "OK", {'Content-Type': 'text/plain' }) response.end() From 04641afed2b54e728b6257da2ae6803680585209 Mon Sep 17 00:00:00 2001 From: "Glitch (xbc30ep450-a2-shortstack)" Date: Sun, 8 Sep 2019 04:41:29 +0000 Subject: [PATCH 03/46] =?UTF-8?q?=F0=9F=94=A6=F0=9F=8C=9C=20Checkpoint=20.?= =?UTF-8?q?/server.improved.js:2480790/8=20./public/index.html:2480790/148?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/index.html b/public/index.html index c56d620e..e41ca3fd 100755 --- a/public/index.html +++ b/public/index.html @@ -6,7 +6,7 @@
- +
From 5c29a755124bcb5b61754f791b1a764123e82678 Mon Sep 17 00:00:00 2001 From: "Glitch (xbc30ep450-a2-shortstack)" Date: Sun, 8 Sep 2019 05:19:29 +0000 Subject: [PATCH 04/46] =?UTF-8?q?=F0=9F=8C=8C=F0=9F=8C=9A=20Checkpoint=20.?= =?UTF-8?q?/server.improved.js:2480790/378?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server.improved.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/server.improved.js b/server.improved.js index cdbd1859..055849aa 100644 --- a/server.improved.js +++ b/server.improved.js @@ -12,6 +12,10 @@ const appdata = [ { 'model': 'ford', 'year': 1987, 'mpg': 14} ] +var playerData = [ + {'name': 'Javier', 'moves': 0, 'medal': 'platinum'} +] + const server = http.createServer( function( request,response ) { if( request.method === 'GET' ) { handleGet( request, response ) @@ -71,4 +75,13 @@ const sendFile = function( response, filename ) { }) } +var board; + +const generateBoard = function() { + board = []; + for (int i = 0; i < 5; i++) { + Math.random() + } +} + server.listen( process.env.PORT || port ) From ce2fd8f691feb2bd6411ec31e9612fb33747907f Mon Sep 17 00:00:00 2001 From: "Glitch (xbc30ep450-a2-shortstack)" Date: Sun, 8 Sep 2019 05:30:30 +0000 Subject: [PATCH 05/46] =?UTF-8?q?=F0=9F=8D=8D=F0=9F=8E=90=20Checkpoint=20.?= =?UTF-8?q?/server.improved.js:2480790/447?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server.improved.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/server.improved.js b/server.improved.js index 055849aa..f017919a 100644 --- a/server.improved.js +++ b/server.improved.js @@ -77,11 +77,13 @@ const sendFile = function( response, filename ) { var board; +// Create a random array of 6 numbers, each from 1 to 6 const generateBoard = function() { - board = []; - for (int i = 0; i < 5; i++) { - Math.random() + board = [-1, -1, -1, -1, -1, -1]; + for (var i = 0; i < 5; i++) { + board[i] = Math.floor(6 * Math.random()) } + return board; } server.listen( process.env.PORT || port ) From cd798480ed5b83492242bf7756a86fc30dc4302d Mon Sep 17 00:00:00 2001 From: "Glitch (xbc30ep450-a2-shortstack)" Date: Sun, 8 Sep 2019 06:05:30 +0000 Subject: [PATCH 06/46] =?UTF-8?q?=F0=9F=8E=86=F0=9F=8F=A0=20Checkpoint=20.?= =?UTF-8?q?/public/index.html:2480790/163?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/index.html | 3 +++ 1 file changed, 3 insertions(+) diff --git a/public/index.html b/public/index.html index e41ca3fd..edb2242c 100755 --- a/public/index.html +++ b/public/index.html @@ -6,6 +6,9 @@
+
From 0c7bd7e2400e33082bdad7911f9cc027261f9c27 Mon Sep 17 00:00:00 2001 From: "Glitch (xbc30ep450-a2-shortstack)" Date: Sun, 8 Sep 2019 06:16:31 +0000 Subject: [PATCH 07/46] =?UTF-8?q?=F0=9F=8C=9F=F0=9F=9B=A2=20Checkpoint=20.?= =?UTF-8?q?/public/index.html:2480790/341?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/index.html | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/public/index.html b/public/index.html index edb2242c..25a8eccb 100755 --- a/public/index.html +++ b/public/index.html @@ -7,7 +7,13 @@
From f80a7c56754b643483d6e0af5281d2d712aa50e4 Mon Sep 17 00:00:00 2001 From: "Glitch (xbc30ep450-a2-shortstack)" Date: Sun, 8 Sep 2019 14:52:46 +0000 Subject: [PATCH 08/46] =?UTF-8?q?=F0=9F=8F=8E=F0=9F=90=93=20Checkpoint=20.?= =?UTF-8?q?/public/index.html:2480790/1918?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/index.html | 43 +++++++++++++++++++++++++++++++++++++------ 1 file changed, 37 insertions(+), 6 deletions(-) diff --git a/public/index.html b/public/index.html index 25a8eccb..b4d79285 100755 --- a/public/index.html +++ b/public/index.html @@ -5,9 +5,35 @@ - - + + + + + + + +
+ + +
+ Second Ball + +
+
+ +
+ Third Ball + -
@@ -25,8 +50,14 @@ // prevent default form action from being carried out e.preventDefault() - const input = document.querySelector( '#yourname' ), - json = { yourname: input.value }, + const firstBall = document.querySelector( '#firstball' ), + secondBall = document.querySelector( '#secondball'), + thirdBall = document.querySelector( '#thirdball'), + + json = { firstball: firstBall.value, + secondball: secondBall.value, + thirdball: thirdBall.value }, + body = JSON.stringify( json ) fetch( '/submit', { From c876bd017a0d14e802d4c532be59672249a9361a Mon Sep 17 00:00:00 2001 From: "Glitch (xbc30ep450-a2-shortstack)" Date: Sun, 8 Sep 2019 15:26:50 +0000 Subject: [PATCH 09/46] =?UTF-8?q?=F0=9F=8F=A8=F0=9F=94=94=20Checkpoint=20.?= =?UTF-8?q?/public/index.html:2480790/3086?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/index.html | 84 ++++++++++++++++++++++++++--------------------- 1 file changed, 46 insertions(+), 38 deletions(-) diff --git a/public/index.html b/public/index.html index b4d79285..a3e3a73b 100755 --- a/public/index.html +++ b/public/index.html @@ -5,45 +5,53 @@ -
- First Ball - -
-
- -
- Second Ball - -
-
- -
- Third Ball - - -
+

Mastermind

+
There is a secret combination of 6 balls with 6 possible colors +
+

Take a guess!

+ First Ball + +
+
+ +
+ Second Ball + +
+
+ +
+ Third Ball + + +
+

+ Previous Guesses +

+ No guesses yet + diff --git a/server.improved.js b/server.improved.js index 7433f1a3..ba46e8d1 100644 --- a/server.improved.js +++ b/server.improved.js @@ -28,6 +28,7 @@ const handleGet = function( request, response ) { const filename = dir + request.url.slice( 1 ) if( request.url === '/' ) { + // When you first enter the page sendFile( response, 'public/index.html' ) }else{ sendFile( response, filename ) @@ -74,11 +75,10 @@ const sendFile = function( response, filename ) { }) } -var board; +var board = [-1, -1, -1, -1]; // Create a random array of 4 numbers, each from 0 to 5 const generateBoard = function() { - board = [-1, -1, -1, -1]; for (var i = 0; i < 5; i++) { board[i] = Math.floor(6 * Math.random()) } From 08af623a66bce827c20f9b871d54f22a41a43ea7 Mon Sep 17 00:00:00 2001 From: "Glitch (xbc30ep450-a2-shortstack)" Date: Sun, 8 Sep 2019 16:25:50 +0000 Subject: [PATCH 14/46] =?UTF-8?q?=F0=9F=90=93=E2=8F=B2=20Checkpoint=20./se?= =?UTF-8?q?rver.improved.js:2480790/92=20./public/index.html:2480790/108?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server.improved.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/server.improved.js b/server.improved.js index ba46e8d1..88822eb6 100644 --- a/server.improved.js +++ b/server.improved.js @@ -18,7 +18,9 @@ var playerData = [ const server = http.createServer( function( request,response ) { if( request.method === 'GET' ) { - handleGet( request, response ) + handleGet( request, response ) + generateBoard() + console.log(board) }else if( request.method === 'POST' ){ handlePost( request, response ) } @@ -28,7 +30,6 @@ const handleGet = function( request, response ) { const filename = dir + request.url.slice( 1 ) if( request.url === '/' ) { - // When you first enter the page sendFile( response, 'public/index.html' ) }else{ sendFile( response, filename ) From 048ca30b3c16e695309a4ac9cee4353f1c66bd4d Mon Sep 17 00:00:00 2001 From: "Glitch (xbc30ep450-a2-shortstack)" Date: Sun, 8 Sep 2019 16:37:51 +0000 Subject: [PATCH 15/46] =?UTF-8?q?=F0=9F=A7=80=E2=9D=A4=EF=B8=8F=20Checkpoi?= =?UTF-8?q?nt=20./public/index.html:2480790/456?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/index.html | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/public/index.html b/public/index.html index 61a9c51d..310e8ab7 100755 --- a/public/index.html +++ b/public/index.html @@ -72,7 +72,7 @@