Browse Source

Add day 11 part ii solution

ApisNecros 1 year ago
parent
commit
b07e40479f
1 changed files with 61 additions and 0 deletions
  1. 61 0
      11/11_2.ts

+ 61 - 0
11/11_2.ts

@@ -0,0 +1,61 @@
+import { StarMap } from "./11_common.ts";
+import { LoadInput } from "../common.ts";
+
+async function main() {
+    const tests = [
+        '...#......',
+        '.......#..',
+        '#.........',
+        '..........',
+        '......#...',
+        '.#........',
+        '.........#',
+        '..........',
+        '.......#..',
+        '#...#.....'
+    ];
+
+    const test_reddit_1 = [
+        "...#......#....",
+        "...............",
+        "#..........#...",
+        "...............",
+        "...............",
+        "...............",
+        "......#.....#..",
+        ".#.............",
+        "#..............",
+        "...............",
+        "...............",
+        "...............",
+        "......#.#......",
+        "............#..",
+        "....#..........",
+    ];
+
+    const test_reddit_2 = [
+        "......#........",
+        ".........#.....",
+        "...............",
+        "...............",
+        "..........#...#",
+        "...............",
+        "...............",
+        "#...#..........",
+        "..#............",
+        "...............",
+        ".........#.....",
+        ".........#.....",
+        "...........#...",
+        "...............",
+        ".#...........#.",
+    ];
+
+    const input = await LoadInput(11);
+
+    const sm = new StarMap(input, 1_000_000);
+    
+    console.log(`The sum of the shortest paths between galaxies is: ${sm.solvePart1()}`);
+}
+
+main();