Browse Source

formatting

karl.hudgell 4 years ago
parent
commit
c22727b864
6 changed files with 16 additions and 6 deletions
  1. 11 2
      .vscode/launch.json
  2. 2 2
      Day 1/part1.js
  3. 3 2
      Day 1/part2.js
  4. 0 0
      node_modules/fs/package.json
  5. 0 0
      package-lock.json
  6. 0 0
      package.json

+ 11 - 2
.vscode/launch.json

@@ -7,11 +7,20 @@
         {
             "type": "node",
             "request": "launch",
-            "name": "Launch Program",
+            "name": "Day1-Part1",
             "skipFiles": [
                 "<node_internals>/**"
             ],
-            "program": "${workspaceFolder}\\app.js"
+            "program": "${workspaceFolder}\\Day 1\\part1.js"
+        },
+        {
+            "type": "node",
+            "request": "launch",
+            "name": "Day1-Part2",
+            "skipFiles": [
+                "<node_internals>/**"
+            ],
+            "program": "${workspaceFolder}\\Day 1\\part2.js"
         }
     ]
 }

+ 2 - 2
Day 1/part1.js

@@ -1,12 +1,12 @@
 const fs = require('fs')
 
-let data = JSON.parse(fs.readFileSync('./data.json'))
+let data = JSON.parse(fs.readFileSync('./Day 1/data.json'))
 
 data.forEach(element => {
     data.forEach(element2 => {
         if (element + element2 == 2020) {
-            console.log('found')
             let answer = element * element2
+            console.log(element + " " + element2)
             console.log(answer)
         }
     })

+ 3 - 2
Day 1/part2.js

@@ -1,15 +1,16 @@
 const fs = require('fs')
 
-let data = JSON.parse(fs.readFileSync('./data.json'))
+let data = JSON.parse(fs.readFileSync('./Day 1/data.json'))
 
 data.forEach(element => {
     data.forEach(element2 => {
         data.forEach(element3 => {
             if (element + element2 + element3 == 2020) {
-                console.log('found')
                 let answer = element * element2 * element3
+                console.log(element + " " + element2 + " " + element3)
                 console.log(answer)
             }
         })
     })
 });
+

+ 0 - 0
Day 1/node_modules/fs/package.json → node_modules/fs/package.json


+ 0 - 0
Day 1/package-lock.json → package-lock.json


+ 0 - 0
Day 1/package.json → package.json