Browse Source

initial commit

karl.hudgell 3 years ago
commit
8d697850a9
6 changed files with 304 additions and 0 deletions
  1. 17 0
      .vscode/launch.json
  2. 13 0
      Day 1/app.js
  3. 201 0
      Day 1/data.json
  4. 46 0
      Day 1/node_modules/fs/package.json
  5. 13 0
      Day 1/package-lock.json
  6. 14 0
      Day 1/package.json

+ 17 - 0
.vscode/launch.json

@@ -0,0 +1,17 @@
+{
+    // Use IntelliSense to learn about possible attributes.
+    // Hover to view descriptions of existing attributes.
+    // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
+    "version": "0.2.0",
+    "configurations": [
+        {
+            "type": "node",
+            "request": "launch",
+            "name": "Launch Program",
+            "skipFiles": [
+                "<node_internals>/**"
+            ],
+            "program": "${workspaceFolder}\\app.js"
+        }
+    ]
+}

+ 13 - 0
Day 1/app.js

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

+ 201 - 0
Day 1/data.json

@@ -0,0 +1,201 @@
+[
+    1954,
+    1850,
+    1825,
+    1732,
+    1536,
+    1759,
+    1877,
+    1400,
+    1579,
+    1708,
+    1047,
+    1810,
+    558,
+    1132,
+    1608,
+    1857,
+    1756,
+    1834,
+    1743,
+    1888,
+    1660,
+    1642,
+    1726,
+    541,
+    1519,
+    1407,
+    1875,
+    1618,
+    1331,
+    1878,
+    1626,
+    1200,
+    1346,
+    1830,
+    1403,
+    1557,
+    1890,
+    1543,
+    823,
+    1435,
+    1903,
+    1377,
+    1931,
+    1885,
+    1422,
+    1411,
+    1563,
+    1818,
+    1643,
+    2004,
+    1364,
+    1446,
+    1071,
+    1699,
+    1140,
+    1617,
+    1974,
+    1758,
+    1537,
+    1980,
+    1709,
+    1812,
+    1178,
+    1822,
+    1648,
+    1517,
+    1477,
+    1935,
+    1848,
+    1534,
+    1734,
+    1484,
+    1985,
+    1485,
+    1963,
+    1329,
+    1809,
+    1380,
+    1552,
+    1895,
+    215,
+    1844,
+    1138,
+    1194,
+    1938,
+    1774,
+    1823,
+    684,
+    1948,
+    1941,
+    1062,
+    1550,
+    1602,
+    1920,
+    1391,
+    1666,
+    1327,
+    1791,
+    1721,
+    1928,
+    1805,
+    1574,
+    1658,
+    1467,
+    1852,
+    1924,
+    1679,
+    2008,
+    1989,
+    1719,
+    1884,
+    1776,
+    1806,
+    1750,
+    1897,
+    1781,
+    1667,
+    1544,
+    1100,
+    1838,
+    1839,
+    1744,
+    1715,
+    1481,
+    1480,
+    1548,
+    1707,
+    1362,
+    1681,
+    1616,
+    1956,
+    1639,
+    1911,
+    1655,
+    1685,
+    1670,
+    1789,
+    1571,
+    1661,
+    1647,
+    1379,
+    1522,
+    1965,
+    1482,
+    1158,
+    1970,
+    1945,
+    1384,
+    1535,
+    1383,
+    1613,
+    1511,
+    1896,
+    1784,
+    1513,
+    841,
+    1619,
+    1645,
+    1125,
+    1932,
+    1873,
+    639,
+    1657,
+    1554,
+    1979,
+    1516,
+    1995,
+    1899,
+    1347,
+    1175,
+    1918,
+    1872,
+    1559,
+    1094,
+    1423,
+    1883,
+    1846,
+    1394,
+    1488,
+    1343,
+    1905,
+    1914,
+    1578,
+    1943,
+    1388,
+    1286,
+    966,
+    1342,
+    1528,
+    1702,
+    1452,
+    1936,
+    2005,
+    1188,
+    1683,
+    1133,
+    447,
+    1072,
+    1893
+    ]

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

@@ -0,0 +1,46 @@
+{
+  "_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",
+  "repository": {
+    "type": "git",
+    "url": "git+https://github.com/npm/security-holder.git"
+  },
+  "scripts": {
+    "test": "echo \"Error: no test specified\" && exit 1"
+  },
+  "version": "0.0.1-security"
+}

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

@@ -0,0 +1,13 @@
+{
+  "name": "advent-of-code",
+  "version": "1.0.0",
+  "lockfileVersion": 1,
+  "requires": true,
+  "dependencies": {
+    "fs": {
+      "version": "0.0.1-security",
+      "resolved": "https://registry.npmjs.org/fs/-/fs-0.0.1-security.tgz",
+      "integrity": "sha1-invTcYa23d84E/I4WLV+yq9eQdQ="
+    }
+  }
+}

+ 14 - 0
Day 1/package.json

@@ -0,0 +1,14 @@
+{
+  "name": "advent-of-code",
+  "version": "1.0.0",
+  "description": "",
+  "main": "index.js",
+  "scripts": {
+    "test": "echo \"Error: no test specified\" && exit 1"
+  },
+  "author": "",
+  "license": "ISC",
+  "dependencies": {
+    "fs": "0.0.1-security"
+  }
+}