Browse Source

udpates for day 3

karl.hudgell 3 years ago
parent
commit
0f325c8a1b
5 changed files with 377 additions and 39 deletions
  1. 9 0
      .vscode/launch.json
  2. 323 0
      Day 3/data.txt
  3. 23 0
      Day 3/part1.js
  4. 17 39
      node_modules/fs/package.json
  5. 5 0
      package-lock.json

+ 9 - 0
.vscode/launch.json

@@ -39,6 +39,15 @@
                 "<node_internals>/**"
             ],
             "program": "${workspaceFolder}\\Day 2\\part2.js"
+        },
+        {
+            "type": "node",
+            "request": "launch",
+            "name": "Day3-Part1",
+            "skipFiles": [
+                "<node_internals>/**"
+            ],
+            "program": "${workspaceFolder}\\Day 3\\part1.js"
         }
     ]
 }

+ 323 - 0
Day 3/data.txt

@@ -0,0 +1,323 @@
+....#...##......##..#..#.#...#.
+..######...#......#....#..#.##.
+..#.#...##......#.#..#..#....#.
+..#.....#..#.#........#.#..#..#
+#......##..###...#.#..#.....#..
+#.......##...###...#....#......
+.....##...#......##.#.#..#.##..
+.........#......#.....#......#.
+..#.#..#....#....#......##.#.##
+.#...#..#.............#.#..#.#.
+....#..#.#.##.#....#..#..#....#
+...#..#.....#.......#...#..#..#
+.....#.....#.......#..#...#....
+.##.......#...#..#........#...#
+...#.......#.#.#...#.#.#......#
+#....#..#.....#......##....#..#
+###.#......#.#.#.#..#....#....#
+......##......#.#...#...#..#...
+.....#......#.#.#......#.#.....
+...##...#..#........#..#.##....
+..##.#.#..#...###..........#.#.
+.#..#..#.....#.........#.###.#.
+....##.....#...#...##..#.##...#
+....#.##....#.....##......#....
+........#.#.........#.#.......#
+#....##.#....#..#...#..........
+#..###......#....##..........##
+....##.#.....#..#.##......#....
+#..#......#......#.............
+...##.....##.......#.......#...
+#...#.#.....#..........#...###.
+#.....#..#.#.###...#......###..
+...##.#......#........#..#.....
+......#.....###.#...##........#
+.#......##......##....#....#...
+..#.#..#.....##....#....#..#...
+..#.#.....#.##.#.....#.....#...
+....#.......#...#.........##...
+.#....#..#.......##.......#....
+..#..##.....#...##.##.#.#......
+.##.#....#............#.......#
+.......#...#..#.#.##.....##..##
+..###....#..#.##........##.#...
+....#.#..#.....#..#.#.....#....
+..#..#.#..............#..#.....
+.......#.#.#.........#......#..
+...##..#.#...#......##.#.......
+#....#.#.........#...#....#..##
+.#..#.#...#.......#.#.#....#.##
+.#..###.#..#.#.....#..#........
+#.#..##.###.....##.........#..#
+#...##...#..##..#..#..........#
+.#...#..#......................
+...##..###...........#.#...##..
+..........#.#....#.#...........
+..#....#....#..#....#.#.#......
+.#..#.....###......#...#...#...
+#.##..#..#.........#..#....#...
+........#......#...#.........#.
+..#.....#.#..##...#.#.#...##...
+..#...........#.##..#.#..#.##..
+..............##...#.#......#..
+#.#..#....#...##.###........#..
+.#...#..#........#........##..#
+.....##..#...#.....#.#.........
+.#...#...#....###...#.#.#..##..
+....#.........#....###..##....#
+.#....#...####...##....####.#..
+..#..#.......#..#......#.#.#...
+....#....#.......##..#.#.......
+..#....#...........##.#.##.....
+#..#..#...##.##....#.#.#.###.##
+...#...#....#.#...##...#....###
+......##........#.........#.#..
+....#####..#..##.......#.#....#
+....##..#...###....#..#.....#..
+..#........#..#.#.....#....#...
+..#....#......#..#...#......#..
+...#.....##...#.#..##.....#..#.
+...#..#.......####.##...#......
+.....#..#..#.##..##....#..#.#..
+..#..#..##.#.#.##..#..#...#....
+...#..........#.........#....##
+.##.....###...............#.##.
+...##...........#.#.#......#..#
+.#...#.#.##....#....#..#.......
+.#...###.#....#..#..#..#......#
+#..#........###...........#..#.
+..#...#......#.#.#......####.#.
+...#.#....##.#.....#.....##....
+...###..#.#.#...#.....#.###..#.
+.#.#..#...##......#..........#.
+##.....#.......#.#..###...#.#..
+##.###....#.....#.....###.#....
+#...#..##....#.#...#...#......#
+.....##.#........#.###.........
+.#..#..#.#......##.#...#.#.....
+#..#.#........##...........##.#
+#...###..#..####..#.#..........
+..#...#....#...##.#....#....##.
+......#.#........#.....#..#....
+#.........#...#.....#...#..##..
+#....#.........#...#.##..###.#.
+#...###...#.##.#.#.............
+#.#....#....#......#....#.#...#
+##...#.##......#..#.#....#.....
+....#...#.##....#..............
+.........##..........#..##..#..
+......##....#.#......#.........
+..#.#..............#......#..##
+...........##.......#.#.#......
+##...#........##.......#.#.....
+....#...#...#....#.#......##...
+...#..#.#.#.........#..#.#....#
+.##.#...#.#.........#.....##.#.
+#.#.....#.#.....#..............
+..#.#..#....#..........#..##...
+...#..#....................#..#
+...........#...........#...#..#
+............#...#............##
+..#....##......##...........#..
+..#..#..#....#....##......##.##
+##..........#..##.##.#...#.....
+............#..#........###.#..
+###...##.#.#....#....#.#....#..
+...#......##...#.......####....
+.......#..#..#.#.....#.........
+........##.......##.....#......
+#.#...#.###....#..#...##.......
+...#.#....#..#####.#..##.#.....
+..#.#..##.......###...#.....#..
+..#.......#..#...#...#..#.##...
+......#..#.......#.....#....#..
+.......#........#.#.......##..#
+.#.#.....#.......#.......##..#.
+..#.#....#.#.#####.....#...#...
+#..#............###.......#..#.
+........##.........#..#...###..
+.#............##...#.....#.....
+.#..##..#....#....#.......#....
+....##..........##.............
+.##..........#..#..#....#...#..
+...#..#..#............####.....
+.............#..#.##..#.#.##...
+.....#........#....#.#.......#.
+###.#..#.#...#....##...........
+....#......#...#....##.......#.
+.......#.#...#.#...#........##.
+..........#........#..#.##.....
+##..#.#.....##.#...............
+.....#....#................#...
+...##....#........##.#....#....
+.....##...###....#.#..#.......#
+.....#.#.........##....###.....
+.#.....##......#..##..##...##.#
+.#..............#.....#.#......
+.##......#..#..#......##.......
+.......#..................#....
+...#.#...##......####.........#
+#....#####.#.#..#..#..#...#...#
+##.#...#.......#....#...#...###
+...#........#.....#...#.##.....
+..##....#.......#....#.......##
+#......#..##...#..##.#.....#.#.
+..###........#.#..#........#.#.
+...#.###..........#.....#.#.#..
+#.###.....#...#...#..##..###...
+#....#.#.....#.#........#......
+........#.......##.......#.....
+...........#...#......##.......
+............#...#....#..#.....#
+#.#.#.#....#.....#.#..........#
+#.##...#...#..#....##.#.......#
+...#..#......#..#...##..##..#..
+#....#......#.#.....##.#..#....
+#....#..##.#......#.#.....#..##
+.#..##....##....#.#...#...#....
+#.#.###....#.#............#...#
+.#.#....#..#..........#....#.#.
+......#..#.#...............##..
+..#......###.#..........#.###..
+....#.##.#..#...##..#.#...#....
+..............#...##.......#.##
+.#...........#....#....#.##....
+#..#....#.....#...#.....##...#.
+.........#...#.##.......#...#.#
+.....#......#.........#.#..#...
+##..........#.#..##...#.#.#....
+##..##.#..#..#.....#.##....#...
+........##....#.#.#....#......#
+.#.##...#.###....#.........#..#
+..........#....###..#.........#
+#.#..#.#...#.......#..##.......
+..#....#...###..............##.
+#..###.....####...#..#..#...#..
+......#..#...###........###....
+..#.....#...#.......#....###..#
+.#.........#.#.#....#.#.......#
+#.#.###.#.#...........#........
+......#..#.........#........#..
+...........##.#........#.#...#.
+.....#.#......##.......#.....##
+...##...#............#..#.....#
+.....#..##....##...##.#..#.#...
+...#...#........#.#......##....
+........#..##..#..#......##.#..
+.#.#.....#.....#...........#.##
+.#...#.#............#......#...
+.....#...#........#....#..#.#..
+...##....#..#...#..............
+#....##.#.#............#.......
+#..#..#.....##..#........##.#.#
+##..#.#....#....##.......###..#
+.#.#.#.....###.....#.#......###
+.....#..#...###...#....#.#...#.
+.##.....................##....#
+.#.....#.........#....#.....##.
+#...#....#.#...###.......#.#..#
+...#.................#.#....#.#
+.##...#.#......................
+.##.#........#...##............
+.#....#.....#.........#.##..##.
+#......#...##..#.........##.##.
+......#......#...####..#.##....
+.###....#..##......#.##......#.
+..#...#....#..#.......#.#......
+#....#...#.................#.#.
+....#.#.#..#...#..#.......#.#.#
+#.#...##.......#.....##.#......
+#.........#.....##..##..#......
+....#..##..#.....#..#..#.#..#..
+......#.#..#.#.#....#.#.......#
+.##......#..#....##...##..#....
+..#..#......#...##..#.##.....#.
+..#..#.......#.#....#.....#...#
+....#.#.....###...#.......#.#..
+..#....##.....##.#........##...
+#...............##....#.....##.
+.#.........#....#...##.###.##.#
+.#.##..#.............#.#.#..#..
+.#.....#.................##....
+..####.........#.#......#.#..#.
+#.......#..........#.#........#
+.#.#...##.....#.#.......#....#.
+..#.##.#.......###....#....#...
+.#....##.............##.#.#.#..
+#.#.....#.#.#.#..#......##..#..
+.............#..........#.#.#..
+...#.#.............#.#...##....
+.......#..#.#.......#..#.#....#
+.............#.........###..#..
+.#.#..#....#.....#..#.....#...#
+#.....#....##..##.#..#........#
+..##..###.....##....#.#..#.....
+..#...##....#...#.#..........#.
+...##..##.#.....#....#.........
+..#...#........##.#..#........#
+#.............#.###......#.##..
+.#...#........#...........#...#
+..##.......#.#..##.##......#...
+...#.#...##....##..#...........
+.#......##........#....##....#.
+.........#..#....#...#..##.##..
+....#..#.#...#.......#.#.##....
+...#.#......#.#..#..#.#....#..#
+.......#........#.........###..
+#.#..#.#.........##............
+##..##..#.##..###...#.#...#....
+.#....#.#..#...#....#.##.....#.
+.#.#.#.#........##...#..#.#.##.
+.#..#.#..#...........#..#......
+..#.##.#...#....#.........#...#
+.....##...#.#...#...#....#.....
+..#..........#.#.#.......##.#..
+#.#............#..#.....#..#...
+..#...........##.#.##.#....#..#
+#..####.....#............#.....
+.##......#####.#..#.....#....#.
+...##..#.#......#.#..#..#...##.
+#....................#.##...#.#
+...#............#.............#
+....#.##..........#.....#......
+....##..##....#.#..............
+...........#....##.#.....#.....
+....#.....#....#....#......#...
+#...##........#...#........#.#.
+........#.....##..#.##.#..#.#.#
+....##......##....#.....##....#
+...#.#........##.......#...##..
+#......##..#.#.#....##......#..
+..#.......#.......##..#.##.....
+.#...#...#.#.............##....
+......#.#.#.........##...#..#.#
+.....#..####....#.##..........#
+...#...#.#....#.....#..#.....##
+.........#.......#......###....
+........##..##..#.#.#...###...#
+.#..##.#....#...##.....#.#.#...
+........##...#...##..#.........
+.........#.......#.##..#...####
+#......#.....#..............#.#
+##..##.#.##.....##...........#.
+#.............#.........#......
+...####.#.##..#.#.#.##.#......#
+..#.....##....#...#............
+#..............#......#...###..
+..#..#.#...#.##.........##.....
+..#...##..#........#..#.##..##.
+......###...#..#....#..#.###...
+...##.##.###.....##.#.......#..
+#....#..###..#.......#.#.#..#..
+..##.............##..##...###.#
+.#.#..#.........#..........#...
+.........#.#.....##...#..#...##
+....#..#....#####..#...#..#....
+...#.....#.....#...#.#..#.#....
+.#..#.............#.......##.#.
+...##.......#.#.....##......#..
+...........##..#.##..###...#.#.
+...........#...........#...#..#
+..#....#.##.#..#..#...........#
+..#.....##...#......#...#......
+...###.###.....##..........#..#

+ 23 - 0
Day 3/part1.js

@@ -0,0 +1,23 @@
+const fs = require('fs')
+
+let data = fs.readFileSync('./Day 3/data.txt', 'utf8');
+
+var start = 0
+var right = 3
+var down = 1
+var tree = '#'
+
+let lines = data.split('\n')
+let linelength = lines[0].length - 1
+let totalLines = lines.length
+
+
+
+let dataArray = data.match(/.{1,31}/g)
+let stringSplit = data.split('')
+
+dataArray.forEach(element => {
+    console.log(stringSplit)
+    let t = element.charAt(right)
+    console.log(t)
+})

+ 17 - 39
node_modules/fs/package.json

@@ -1,46 +1,24 @@
 {
-  "_from": "fs",
-  "_id": "fs@0.0.1-security",
-  "_inBundle": false,
-  "_integrity": "sha1-invTcYa23d84E/I4WLV+yq9eQdQ=",
-  "_location": "/fs",
-  "_phantomChildren": {},
-  "_requested": {
-    "type": "tag",
-    "registry": true,
-    "raw": "fs",
-    "name": "fs",
-    "escapedName": "fs",
-    "rawSpec": "",
-    "saveSpec": null,
-    "fetchSpec": "latest"
-  },
-  "_requiredBy": [
-    "#USER",
-    "/"
-  ],
-  "_resolved": "https://registry.npmjs.org/fs/-/fs-0.0.1-security.tgz",
-  "_shasum": "8a7bd37186b6dddf3813f23858b57ecaaf5e41d4",
-  "_spec": "fs",
-  "_where": "C:\\Users\\karl.hudgell\\Documents\\Work\\Advent Of Code",
-  "author": "",
-  "bugs": {
-    "url": "https://github.com/npm/security-holder/issues"
-  },
-  "bundleDependencies": false,
-  "deprecated": false,
-  "description": "This package name is not currently in use, but was formerly occupied by another package. To avoid malicious use, npm is hanging on to the package name, but loosely, and we'll probably give it to you if you want it.",
-  "homepage": "https://github.com/npm/security-holder#readme",
-  "keywords": [],
-  "license": "ISC",
-  "main": "index.js",
   "name": "fs",
+  "version": "0.0.1-security",
+  "description": "",
+  "main": "index.js",
+  "scripts": {
+    "test": "echo \"Error: no test specified\" && exit 1"
+  },
   "repository": {
     "type": "git",
     "url": "git+https://github.com/npm/security-holder.git"
   },
-  "scripts": {
-    "test": "echo \"Error: no test specified\" && exit 1"
+  "keywords": [],
+  "author": "",
+  "license": "ISC",
+  "bugs": {
+    "url": "https://github.com/npm/security-holder/issues"
   },
-  "version": "0.0.1-security"
-}
+  "homepage": "https://github.com/npm/security-holder#readme"
+
+,"_resolved": "https://registry.npmjs.org/fs/-/fs-0.0.1-security.tgz"
+,"_integrity": "sha1-invTcYa23d84E/I4WLV+yq9eQdQ="
+,"_from": "fs@0.0.1-security"
+}

+ 5 - 0
package-lock.json

@@ -4,6 +4,11 @@
   "lockfileVersion": 1,
   "requires": true,
   "dependencies": {
+    "data2grid": {
+      "version": "1.0.2",
+      "resolved": "https://registry.npmjs.org/data2grid/-/data2grid-1.0.2.tgz",
+      "integrity": "sha512-kUlsgpTXx17NWLX+hgvE6RvdKUAuuw/y5Im2cMceclpSmMRWB9tSMJHL6IJFCAmDsIRNAtWtpXJap8Q2jBNDvA=="
+    },
     "fs": {
       "version": "0.0.1-security",
       "resolved": "https://registry.npmjs.org/fs/-/fs-0.0.1-security.tgz",