11_2.ts 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. import { StarMap } from "./11_common.ts";
  2. import { LoadInput } from "../common.ts";
  3. async function main() {
  4. const tests = [
  5. '...#......',
  6. '.......#..',
  7. '#.........',
  8. '..........',
  9. '......#...',
  10. '.#........',
  11. '.........#',
  12. '..........',
  13. '.......#..',
  14. '#...#.....'
  15. ];
  16. const test_reddit_1 = [
  17. "...#......#....",
  18. "...............",
  19. "#..........#...",
  20. "...............",
  21. "...............",
  22. "...............",
  23. "......#.....#..",
  24. ".#.............",
  25. "#..............",
  26. "...............",
  27. "...............",
  28. "...............",
  29. "......#.#......",
  30. "............#..",
  31. "....#..........",
  32. ];
  33. const test_reddit_2 = [
  34. "......#........",
  35. ".........#.....",
  36. "...............",
  37. "...............",
  38. "..........#...#",
  39. "...............",
  40. "...............",
  41. "#...#..........",
  42. "..#............",
  43. "...............",
  44. ".........#.....",
  45. ".........#.....",
  46. "...........#...",
  47. "...............",
  48. ".#...........#.",
  49. ];
  50. const input = await LoadInput(11);
  51. const sm = new StarMap(input, 1_000_000);
  52. console.log(`The sum of the shortest paths between galaxies is: ${sm.solvePart1()}`);
  53. }
  54. main();