Skip to content

Commit 7d29597

Browse files
committed
day 10 pt 1
1 parent 19f3a34 commit 7d29597

File tree

5 files changed

+293
-0
lines changed

5 files changed

+293
-0
lines changed

2025/10/10

2.33 MB
Binary file not shown.

2025/10/go.mod

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
module github.com/DylanMeeus/AdventOfCode/2025/10
2+
3+
go 1.25.5

2025/10/input.txt

Lines changed: 152 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,152 @@
1+
[.#..#] (1,4) (0,1,4) (0,1,2,4) (3,4) {29,29,11,11,40}
2+
[.#.###.#] (0,2,6,7) (2,3) (1,2,3,5,7) (0,1,3,4,5,6,7) (0,1,2,3,5,7) (0,2,4,5,7) (1,2,6,7) (0,2,3,5) (3,7) (2,3,4) {35,44,107,74,41,44,31,81}
3+
[.#.#.#..#.] (1,2,3,4,5,6,7,8) (0,2,3,4,5,8,9) (0,6,7,8) (2,3,5,8) (1,8) (0,2,3,5,6,7,9) (0,4) (0,2,4,6,7) (0,2,5,8) (3,7) (0,2,3,5,6,7) (2,6) {68,24,62,33,50,39,60,57,52,1}
4+
[.##..#] (0,1,2,3,5) (0,2,3,4) (0,1,3,4) (0,1,3,4,5) {38,21,23,38,32,6}
5+
[##..###] (1,2,5,6) (0,1,2,4,6) (0,1,3,4,5,6) (0,2,4,5) (0,1,3,4,6) {28,22,13,17,28,23,22}
6+
[.##.#.] (0,1,3,4,5) (0,3) (0,1,2,3,4) (0,1,2,5) {25,23,23,18,16,7}
7+
[.#.##] (1,3,4) (2) (0,1,3,4) {15,25,9,25,25}
8+
[...#.#.] (0,1,3,4) (2,4) (0,3,4,5,6) (0,1,2,3,5,6) (1,3,6) (0,1,2,4,6) {48,43,38,41,58,20,45}
9+
[.#.#.#..] (0,3,7) (5,7) (0,2,3,4,6,7) (0,2,4,5,6) (0,2,3,4,5,6) (0,1,2,3,4,5) (1,2,4,6,7) {193,35,202,46,202,182,186,50}
10+
[#.#...#] (1,5,6) (2,3,4,5,6) (0,1,2,5) (0,1,2,3,4,6) (0,3) {132,139,125,21,13,128,28}
11+
[.####.##] (0,2,4,5,6,7) (0,2,3,4,6,7) (0,7) (0,3) (0,1,4,6) (2,3,4,5,6) (4,6,7) {49,8,28,28,179,9,179,180}
12+
[.##...##] (0,1,2,5) (2,3,4) (1,5,6,7) (0,7) (0,6,7) (3,4,6,7) (0,3,4) (1,2,3,4) {53,30,43,41,41,18,24,35}
13+
[#......] (2,3,4) (4,6) (0,2,3,4,5) (1,2,3,4,6) (0,1,4,6) (0) (2,5) (2,4) {25,25,42,27,43,20,27}
14+
[#.#.#.] (1,3) (0,4) (2) (1,3,4,5) (0,2,4) (1,2,3,4) (0,1) {21,41,34,27,27,10}
15+
[.#.##] (1,3,4) (0,3) (2,3,4) {12,6,19,37,25}
16+
[.#.#] (2) (3) (0,3) (1,2) (0,1) {119,32,22,114}
17+
[.##.#] (0,3) (0,2,4) (1,2,4) (1,2,3,4) {32,26,43,28,43}
18+
[..#...#.] (4,5,6) (2,3,5) (3,6,7) (0,1,2,3,4,6) (1,5,6,7) (0,1,3,5) (0,1,6,7) (1,2,3,4,5,7) (3,5,6) {31,48,17,207,17,203,231,43}
19+
[####..#.] (1,2,3,4,7) (0,6) (3,7) (1,4) (3,5) (1,2,3,5,7) {11,32,25,35,19,13,11,35}
20+
[#..#..] (1,3,4,5) (0,1,4) (0,1,2,4,5) (0,1,2,4) (0,1,4,5) (3,5) {27,38,14,12,38,24}
21+
[#..####..] (0,8) (0,1,2,3,5,6,8) (0,1,2,4,5,6,7) (0,1,2,4,5,6) (0,1,4,5,6,7,8) (0,4,6,7,8) (2,5,6,8) (2,8) (1,7) (2,3,4,5,7) (1,3,4,7,8) {64,68,51,27,74,62,65,79,92}
22+
[.#..###] (1,2,5) (0,2,3,5,6) (0,2,3,4) (0,1,2,3,5) (0,3,4) (1,2,6) (1,5,6) (2,3) (0,2,4) {48,51,64,52,25,40,43}
23+
[#..#] (0,1,2) (1) (0,2,3) (0,3) (1,3) {29,150,22,15}
24+
[###..####.] (0,1,2,3,6,7,9) (1,2,3,4,5,6,8,9) (1,3,4) (0,2,5,7) (3,4,5) (0,3,4,5,7,8,9) (0,1,2,3,5,6,7,9) (0,1,2,4,6,8) (0,1,4,6,7,8) (1,2,4,5,6) (4,9) (0,5,6,7,8) (2,4,7) {285,105,96,252,301,277,106,272,246,249}
25+
[#...] (3) (1,2) (1) (0,1,2) {13,33,22,15}
26+
[..#.] (2,3) (1,3) (1,2) (0,1) (2) (3) {11,28,41,42}
27+
[#..##.] (0,2,3,5) (3,4,5) (0,1,2,4) (0,2,5) (4) (2,3,4,5) (2,3,5) (1,2,3,5) {36,19,58,176,192,187}
28+
[##....#] (0,1,2,4,5) (0,2,3,4,5,6) (1,2,5,6) (1,2,3,4,5,6) (5,6) (0,2,3,4,5) (2,4,5,6) {35,37,70,49,57,89,74}
29+
[#####.] (0,1,2,3) (1,2) (0,1,3,4) (2,5) (0,4) (0,3) (0,1,2,4,5) {33,29,29,28,9,8}
30+
[##.##.] (0,2,3,5) (0,1,2,5) (1,2) (0,3) (3,4) {10,11,14,16,11,8}
31+
[#..#####.] (0,2,4,5) (2,6) (0,1,2,3,4,7) (2,3,5,6,7) (2,5,6) (0,6,7) (0,1,2,3,7,8) {47,27,89,37,37,49,42,37,10}
32+
[##.####] (1,4,6) (0,2,3,4,6) (2,5,6) (0,1,3,5) (2) (4) (0,1,3,4,5,6) (0,3,4,6) {49,34,42,49,69,25,59}
33+
[..##] (0,2,3) (2,3) (1,2) {180,19,205,186}
34+
[####.###.] (1,2,3,6,7,8) (1,3,7) (0,1,2,3,5,6,8) (1,4,5,8) (2,3,5) (0,1,2,3,4,5,6,7) (3) (4,5,8) (0,1,3,4,6,8) (0,1,2,4,6,7,8) {42,58,37,54,53,48,42,25,61}
35+
[.#.#.#.#.#] (2,4,9) (1,2,4,6,9) (0,1,2,3,4,8) (0,4,5,6) (0,1,2,3,4,5,8,9) (0) (2,4) (3,5) (5) (1,2,4,5,6,7,8,9) (0,1,2,3,4,7) (0,1,2,3,5,8,9) {75,53,61,43,69,60,27,6,41,32}
36+
[##..#] (2) (0,3) (0,1,4) {21,11,7,10,11}
37+
[#..###] (1,3,4) (0,3,4,5) (0,1,3) (0,2,3,4,5) (0) (0,2,4) (0,1,2,4,5) (2,4,5) {54,20,43,25,53,40}
38+
[##.##.#...] (0,1,2,3,4,5,6) (4,7) (0,2,4,5,6) (0,5) (5,8) (4,5,6,8) (0,2,4,5,6,9) (0,3,4,5,6,7,8,9) (1,7,9) (3,6,9) (4,7,9) (1,2,6,9) {38,27,37,21,50,57,57,31,22,52}
39+
[#.#.] (0,2) (1,3) (0,1,2) (0,3) (0,1) {23,21,21,17}
40+
[######.] (4,5,6) (1,2,3,6) (0,2,4,5) (0,2,4,6) (1,3,5,6) (1,2,3,5,6) (0,1) {33,46,37,28,15,21,41}
41+
[#..####] (0,2,3,4,5,6) (0,1,5,6) (1,3,4,5) (2,4) (0,3,4,5,6) (0,2,5) {45,8,30,35,37,51,31}
42+
[#..#.#####] (2,3) (0,1,2,4,5,7,8,9) (0,1,2,4,5,6,7,8,9) (0,4,5,6,7,9) (0,1,2,4,5,6) (8,9) (3,4,8) (0,2,3,4,5,7,8,9) (0,1,2,4,6,8,9) (1,4,7,8) (0,1,2,5,7,8,9) {68,65,83,33,66,66,27,70,87,77}
43+
[.#..##..#] (1,8) (0,3,4,6,7) (6,8) (2,7) (0,5,8) (1,3,4) (0,3) (2,8) (0,1,2,4,5,7,8) (0,2,3,5,6,8) (3,8) {48,3,43,50,2,35,31,14,78}
44+
[###.] (0,1) (0,3) (1,2) (1,3) (0,1,2) (2,3) {145,166,153,18}
45+
[..##.#.] (0,1,3,4,5,6) (1,2,4,6) (2,3,5) (3) (0,1,4,5,6) (0,1,5) (0,1,2) {50,58,29,34,34,43,34}
46+
[.##.######] (1,3,4) (6,7,9) (5,7) (0,1,2,3,5,7,8,9) (0,3,4,8,9) (3,9) (1,2,4,6,8,9) (1,3,4,5,6,7,8) (2,3,4,6) {7,48,37,58,56,33,69,51,45,57}
47+
[...#.#.#] (1,5) (0,2,3,4,5,6) (0,3,6,7) (2,4,7) (0,1) (0,2,3,5,6,7) (0,1,3,4,5) (0,2,3,7) {196,180,22,37,19,39,26,20}
48+
[.#.#.#.#] (0,1,2,6) (0,6) (1,2,5) (3,5,7) (1,2,3,5,7) (0,1,2,3,4) (0,1,3,5,6,7) (3,4,6) (1,2) (0,2,3,5,6,7) {49,66,51,64,11,70,44,53}
49+
[#.##.] (0,2,4) (0,3,4) (2,4) (1,2,4) {38,14,45,18,63}
50+
[##.##.] (2,3,4,5) (2,3) (1,3,4,5) (0,1,3,4) (0,1,2,3,5) (2,5) {16,16,43,38,20,33}
51+
[.#..#] (2,3,4) (0,2,3) (0,1,3,4) (1,4) (1,3,4) (0,1,3) {29,24,24,36,24}
52+
[.#....#..] (3,6,7) (0,2,3,4,5,6,8) (0,3,8) (0,2,3,6,8) (0,1,2,4,6,7) (4,5) (2,4,6,8) (0,1) {51,26,34,30,48,24,39,19,35}
53+
[#####] (1,2) (0,3,4) (0,1,2,4) {19,36,36,3,19}
54+
[..##.] (1,4) (1,2,4) (0,3,4) (0,1,2,4) (0,2,3,4) (1,3,4) {17,38,24,11,49}
55+
[.###.#...#] (0,1,2,3,4,6) (0,2) (4,7) (2,3,5) (0,1,3,4,6,7,8,9) (1,4,9) (0,1,6,7,8) (3,5,6) (2,3,4,9) (0,1,2,3,6,9) (3,4,5,6,7,8,9) (0,1,2,3,6,7,8,9) (3,9) {142,135,135,142,128,13,138,33,20,35}
56+
[#.#####.] (0,1,2,5,6,7) (0,1,2,3,4,5) (0,2,3,4,7) (0,1,3,4,6) (0,3,5,6,7) (3,5) {38,28,21,33,23,28,25,18}
57+
[#.#..#.#..] (0,1,2,3,4,5,7) (0,2,3,4,6,8) (1,2,3,4,9) (0,1,2,4,6,7,9) (1,5,6,8,9) (6,8) (2,5,8,9) (1,2,3,4,6,7) (7,8) (2,6,7,8,9) (0,2,3,5,7,9) {199,196,223,46,186,54,208,231,60,208}
58+
[#..##] (0,2,3,4) (0,1,2) (1,2,3,4) (0,1,4) (0,1,3,4) {23,170,160,167,169}
59+
[#.###.##.] (3,5) (0,1,2,3,4,5,8) (2,3) (3,6,7) (3,5,6,7,8) (1,2,3,4,5) (0,3,4,6,7,8) (2,4,5,6,7) (0,8) {42,21,45,63,39,41,28,28,45}
60+
[#..###] (0,1,3) (2,3,4) (1,3,4) (4,5) (3,4) (0,1,5) {5,25,17,57,53,1}
61+
[.#.#######] (0,3,4,6,9) (0,2,3,5,7,9) (1,3,4,5) (2,4,5,8,9) (1,4,6,8,9) (0,1,2,5,6,7,9) (0,1,3,5,6,7,8,9) (0,2,4,8) (1,5,7) (0,1,2,3,4,5,8) {49,73,33,33,31,72,56,61,40,69}
62+
[#.##] (0,1,2,3) (0,2,3) {7,1,7,7}
63+
[..#...##.] (5,8) (0,1,3,7,8) (0,2,4,5,6,7,8) (2,5) (0,2,5,7) (1,3,5) (0,8) (3,4,8) (2,6,7) (5,6) {32,17,17,35,19,234,10,19,234}
64+
[#..#.] (1) (0,3) (0,2,3) (1,3,4) (2,3,4) {15,8,21,30,15}
65+
[##.###.#..] (1,2,3,5,6,7,8,9) (1,3,6,8,9) (1,2,3,4,5,7) (0,1,2,3,4,5,6,7,9) (0,1,3,4,5,7,8,9) (0,2,4,6,7,8,9) (1,2,3,4,6,9) (3,4,5,6,7,8) {23,43,46,60,51,48,64,53,37,48}
66+
[#....] (0,2,3,4) (0,3) (2,3,4) (0,1,2,4) {12,3,21,20,21}
67+
[.#..##] (3,5) (4,5) (0,1,3,5) (0,2,3) (2) (0,2,4) (2,3,4) (1) {28,19,33,35,20,39}
68+
[#.#..##.] (0,1,3,4,6,7) (0,1,2,3,5,7) (1,2,3,7) (0,2,5,6) (1,3,4,6,7) (0,1,2,6,7) {37,31,42,28,6,29,26,31}
69+
[###.#...#] (3,6) (1,2,3,4,5,6) (0,8) (6,7,8) (0,2,3,4,5,7) (0,1,2,3,7,8) (0,2,3,5,7) (2,3,6) (0,2) {60,32,64,71,31,32,38,43,40}
70+
[#.#..] (0,1,2,4) (1) (0,2) (2,4) (1,2,3) (2,3) (3,4) {23,30,48,33,20}
71+
[.#..#...##] (2,3,7) (4,6) (0,1,2,3,4,5,7,8,9) (0,1,2,3,5,6,7,9) (0,1,2,4,5,6) (0,7,8) (3,4,6,7,8) (0,4,6) (0,2,3,4,5,7,9) (0,2,3,5,6,8,9) (2,7,9) (1,5) (2,4,7,9) {64,23,40,28,51,31,37,54,30,30}
72+
[#.##] (0,2,3) (1,3) {19,5,19,24}
73+
[###.] (1) (0,1,2) (0) (2) (0,1) (1,3) {42,45,21,10}
74+
[#.#...##] (2,3,4,6,7) (0,2,3,4,5,7) (2,4,5,7) (0,2,3,4,5,6,7) (0,2,4) (0,1,3,4,5) (5,6) (1,5,7) {52,36,53,51,72,81,41,59}
75+
[#..##] (3,4) (2,4) (0,1,2) (1,2,3,4) (0,3) (1,3) {173,179,173,48,29}
76+
[.####..##.] (2,5) (2,3,4,5,6,7,8,9) (0,1,2,3,5,6,8) (0,1,2,3,4,6,7,9) (1,2,3,4,5,6,8) (0,4,8) (2,5,8) (1,2,4,6,8,9) (1,2,3,4,5,6,8,9) (0,1,2,3,4,5,6,8,9) (2,3,6,8) {41,46,89,59,42,70,60,8,69,36}
77+
[#..#.##] (0,2,4,5) (0,1,3,5,6) (2) (0,2,3,6) (0,1,2,4,5) (1,3,6) (0,2,3,5,6) (3,4,5,6) {54,38,56,179,176,193,179}
78+
[..#.] (0) (3) (1,3) (0,1,2) (1) (0,1) {30,31,10,21}
79+
[.#..##.#..] (0,4,5,6,7,9) (4,5,6) (2,6,9) (0) (0,3,4,8) (0,1,2,3,4,5,6) (0,1,3,9) (1,3,4,5,7,8,9) (0,1,2,3,4,6,7,9) (0,2,7) (1,2,3,5,6,7) (1,2,4,8) (0,3,5,6,9) {198,73,190,70,68,45,71,166,24,75}
80+
[....#..#] (2,6) (0,1,4,5) (2,4,6,7) (3,7) (0,1,2,4,5,7) (0,1,2,3,6,7) (0,1,4,5,7) (1,3) (1,2,3,4,5,6,7) {63,80,64,51,58,57,49,78}
81+
[...#.#####] (0,1,7) (4,9) (1,2,3,4,5,6,7,9) (0,1,4,9) (1,8) (0,1,2,4) (0,1,3,4,6,7,9) (1,6,7) (0,3,4,9) (1,2,3,5,6,8,9) {56,65,39,40,67,19,27,16,16,60}
82+
[.##..#.] (0,1,3,5,6) (1,2,3,5,6) (1,2,3) (3,5) (0,2,3,6) (0,4,5) {41,30,16,52,17,64,35}
83+
[###.] (0,1,3) (2,3) (0,1) {19,19,19,34}
84+
[...##.] (3,4) (0,2,3) (0,1,2,3,4,5) (0,4) {27,11,25,42,30,11}
85+
[.#..] (0,1,2) (1,2) (2,3) (3) {8,28,29,12}
86+
[#...#.##] (0,2,3,5,6,7) (1,3,4,7) (0,1,4,5,6,7) (2,3,4,5,7) (1,2,4,7) (2,4,5,7) {9,24,43,41,47,32,9,56}
87+
[..#.#] (0,1,4) (0,1) (1,2,3) (1,2,3,4) (0,1,3,4) (2) (3,4) {22,27,5,21,23}
88+
[#...#.] (0,1,3,4) (1,2,3) (0,1,5) (1,5) (0,1,3,4,5) (1,4) {39,56,11,32,24,24}
89+
[....#.#] (0,3,4,6) (0,2) (1,4,5) (0,2,3,5,6) (2,6) (1,5,6) (0,1,3,6) {48,35,33,33,25,43,38}
90+
[.#####.] (0,1,5,6) (3,6) (1,3) (0,5,6) (2,5) (4,6) {7,14,17,29,17,24,42}
91+
[#..#.#...] (0,1,2,3,4) (0,6) (0,2,3,6,7) (0,1,4) (0,1,2,3,7,8) (0,1,3,8) (0,2,3,4,5,7,8) (1,2,3,5,7) (1,3,4,5) {64,59,45,74,47,45,18,45,33}
92+
[.###.#] (1,2,3,4,5) (0,2,3,4) (3,4) (0,1,2,5) (0,1,4,5) {50,51,50,42,58,51}
93+
[#..#..##.] (3,7) (0,1,2,5,6,7,8) (0,2,3,4,5,6,8) (1,2,3,4,5,6) (1,2,5,7,8) (0,4,7) (1,2,5) (0,1,6) (0,1,2,3,4,5,8) {37,38,38,26,27,38,34,14,31}
94+
[..#.] (1,3) (1,2,3) (2) (0,3) {4,14,25,18}
95+
[#.#####.#] (0,1,2,3,4,5,6) (0,3,4,6) (0,1,2,4,5,6,7,8) (0,2,3,4,5,6,8) (1,3,6,7) (0,3,5,6,8) (0,3,4,6,8) (0,1,3,5,6,7) {215,175,29,209,49,195,217,172,39}
96+
[######.] (0,2,5,6) (3,5,6) (2,3,4,6) (1,2,4) (2,5,6) (0,2,3,5) (0,3,4,5,6) (6) (1,2,3,4,6) {131,13,146,122,25,137,46}
97+
[.###] (1,2,3) (0,2,3) {18,3,21,21}
98+
[#...#...#.] (4,7) (4,7,8,9) (0,1,2,3,4,5,7,8) (1,6) (1,2,3,7) (0,1,3,4,6,7,9) (1,2,3,5,6,8) (1,3,5,6,7,9) (0,4,5,7,9) (1,2,8,9) (0,3,7,9) (0,2,3,4,5,6,7,8,9) (0,3,4,5,6,8,9) {209,80,68,239,85,92,80,251,80,245}
99+
[..#.] (2) (1) (0,2,3) {3,151,8,3}
100+
[##..#.##] (2,3,6,7) (0,1,3,4,5,6) (2,4,7) (2,4,6,7) (0,1,2,3,5,7) (0,6) (0,2,3,4,5,6,7) (0,1,2,3,4,5,7) (0,1,4,5,7) {61,41,82,71,68,57,57,87}
101+
[..#..##.#] (2,3,4,5,6,7,8) (1,4,6) (0,1,2,3,4) (0,1,2,3,5,6,8) (0,1,2,3,4,6,8) (4,8) (1,2,7) (0,1,2,3,4,7,8) (1,2,4) (1,2,4,5,8) (1,2,4,5,7,8) {159,223,228,172,217,44,33,48,69}
102+
[.##.##..#] (0,1,5,7,8) (0,3,5,6,7,8) (0,1,3,5,6,7,8) (1,4,6) (0,2,3,5,6,7) (6) (3,4,6,7) (1,3,6,8) (0,2,6) (6,7) {42,25,23,31,24,23,84,36,23}
103+
[.###..] (0,3,4) (0,3,5) (1,3,4,5) (1,2,4) (1,3,4) (0,1) (0,1,3,5) (0,2,5) {62,60,37,66,53,64}
104+
[.##.##..] (0,1,2,3,4,6,7) (3,4) (3,4,5,6) (0,1,2,3,5,7) (0,1,3,5,6,7) (1,2) (3,6) {27,27,19,72,49,29,57,27}
105+
[#.#..##.] (1,3) (2,3,4,6) (1,4,5,6,7) (1,3,4,7) (2,3,6) (1,2,4,5) (0,3,4) (1,2,3,4,6,7) (0,3,4,6,7) {26,47,33,84,65,12,46,37}
106+
[.#.#] (1,3) (0,2,3) {17,158,17,175}
107+
[###...] (0,2,4,5) (0,1,2,3,4) (2,3,4) (0,1,3,4) (0,1,2) {66,50,47,37,53,16}
108+
[.#####....] (1,8,9) (3,4,6,7,8,9) (0,1,2,3,5,6,7,8) (0,1,3,4,5,7,8,9) (5,7) (2,4,9) (1,2,4,5,7,9) (0,1,2,6,7,9) (0,2,3,4,5,6,7,9) (0,1,6,7,8) {23,39,38,32,42,44,38,69,38,56}
109+
[....#.] (0,3,4,5) (0,2,4) (0,1,2,4) (3,5) (0,3,4) (0,1,3) (2,3,4) {24,5,20,32,34,14}
110+
[#..#......] (0,1,2,4,7,8,9) (2,7) (0,1,4,6,7,8) (0,2,3,4,5,6,7,8) (0,3,4,6,9) (0,5,7,8,9) (3,6,9) (0,1,3,5,6) {58,26,16,52,24,45,55,33,31,38}
111+
[.....#] (0,1,3,4,5) (2,3) (2,3,4,5) (0,1,2,4) {161,161,160,37,161,19}
112+
[#####] (2,3,4) (3,4) (0,1) (0,2,3,4) (1,2,3) {31,17,41,44,40}
113+
[#.#...##] (0,2,3,4,5,6) (0,2,3,4,5,6,7) (1,2,4,6,7) (1,2,4,5,6,7) (0,1,4,6,7) (6,7) (1,2,4,5,7) (0,3,5,6) {122,22,137,120,139,128,159,143}
114+
[.#.###.##] (1,3,5,6) (4,6) (0,5) (1,6) (0,1,3,4,5,6,8) (2,3,6) (0,1,2,3,5,7,8) {25,39,24,47,11,44,56,7,11}
115+
[.###] (0,1) (0,2,3) (2) {26,13,15,13}
116+
[#..#...#..] (0,1,2,3,4,6,7,9) (0,1,2,3,6,8) (0,1,2,3,4,7,8) (0,2,4) (0,3,6,9) (0,1,4,5,8) (2,5,7) (0,2,3,4,5,8,9) (1,2,3,4,5,9) (3) (1,2,6) (1,3,5,7,8) {71,62,66,71,47,24,50,41,41,35}
117+
[.##.#.#.##] (1,2,3,4,6,9) (3,6) (1,2,5,6,8) (0,3,8) (0,1,2,3,4,5,6,7,9) (1,2,3,4,5,7,8,9) (0,1,2,4,9) (0,1,5,6,7,8,9) {20,47,45,43,33,25,39,13,32,35}
118+
[#..##] (0) (1,2,3) (0,2) (0,1,3) (0,3,4) (0,1,4) (1,2) {197,39,26,167,176}
119+
[.....####] (1,2,3,5,7,8) (7,8) (3,7) (0,1,3,4,5,6,7,8) (5,6) (2,3,4,5,6,7,8) (6,7,8) (1,2,3,5,6,7,8) (0,1,5,6,7) (0,1,2,3,5,7,8) {23,41,26,52,17,60,40,61,42}
120+
[.#.##] (0,1,2) (1,3,4) (0,2,3,4) {13,9,13,22,22}
121+
[#..#] (0,1) (1,2) (3) (0,2) (2,3) {10,18,26,12}
122+
[#....#...#] (3,7) (2,8,9) (0,1,3,4,5,6,7,8,9) (2,3,5,6,7,8) (0,2,3,4,6,8) (3,4) (0,2,3,4,6,7,8,9) (0,1,2,3,5,6,7) (2,6) {54,27,66,58,35,28,62,40,48,29}
123+
[###.#####] (1,7,8) (0,1,2,3,5,7,8) (0,2,3,8) (0,1,2,3,4,5,6) (0,1,2,4,5,6,7,8) (7,8) (0,2,3,4,5,6,8) (2,4,6) {39,28,48,27,40,32,40,19,36}
124+
[...#.##..] (3,7) (2,3,5,6,7,8) (2,4,8) (2,7) (1,2,3,5,6,7,8) (1,4,5,6,8) (0,2,3,4,6,7,8) (0,5,7,8) {10,13,38,17,34,15,21,36,36}
125+
[####.###] (0,2,3,4,5,6) (5) (0,1,2,4) (0,3,6) (0,2,3,4,6,7) (1,3,4,5,6) (2,3,4,6) {57,25,40,53,49,34,53,6}
126+
[...##] (0,1,3,4) (3,4) (1,2,3,4) (0,1,2) (0,2) {49,55,46,54,54}
127+
[########] (6,7) (0,1,4,6,7) (0,2,3,6,7) (2,3,6) (0,2,3,4,7) (0,3,6,7) (1,2) (0,2,4,6) (4,5) (2,4) {34,26,31,10,54,18,48,38}
128+
[#..#######] (1,2,3,6,7,8,9) (0,2,3,4,5,6,8,9) (1,4,5,7) (2,3,9) (1,8) (3,7) (0,5,6,7,8,9) (4,5,7,8,9) (4,6,8,9) {127,13,20,28,12,138,134,152,148,157}
129+
[##..#.#] (0,2,3,5) (2,3,4,5,6) (0,2,4,5) (2,3,5) (0,1,2,5,6) {30,4,53,29,33,53,17}
130+
[..#..#.##] (0,1,2,4,7) (0,3,4,5,6,7,8) (0,2,3,4,5,6,7,8) (2,3,6,7,8) (1,2,3,4) (1,2,4,5,6,8) (0,1,2,3,4,6) {40,39,52,63,57,18,46,36,30}
131+
[#.##..###.] (0,1,2,3,6,7,8,9) (0,7,9) (2,4,5,7) (2,3,4,5,6) (1,3,4,5,6,7,8,9) (0,4,5,6,7,9) (0,1,2,3,4,5,8) (0,1,3,8) (2,3,4,5,7,8) {59,58,34,67,55,55,56,60,60,53}
132+
[#..##.....] (0,1,6,8) (0,1,2,3,4,6,7,9) (0,1,2,3,5,6,7,9) (0,1,3,4,5,8) (0,1,5,6,7,8,9) (0,2,9) (0,1,2,3,4,5,6,7,8) (0,1,5,6,7,8) (1,2,3,4,5,7,8) (1,2,4,7,9) (0,2,3,4,5,8,9) {262,251,67,59,45,62,224,63,214,65}
133+
[#.##] (0,1) (1,2) (2,3) (0,2,3) {117,33,118,101}
134+
[##.#.#] (1,3,4) (0,1,3,5) (1,2,3) (0,2) (0,4,5) {20,123,124,123,7,13}
135+
[#.#.#..##.] (0,1,2,3,4,7,8,9) (2,3,5,9) (3,4,7,8) (0) (0,1,2,3,4,5,6,9) (4,5,6,7,8) (1,2,5,6,7,9) (0,3,7,8) (1,2,3,6,7,8) (0,3,4,5,7,8,9) (1,3,5) (5,7) {59,64,57,80,59,68,44,74,54,54}
136+
[#.#..##] (1,3,4,5,6) (2,5) (0,1,4,5,6) (3,4) (0,1,2,3,4,6) (0,1,2,5,6) (0,1,2,3,5) (1,2,3,5,6) {54,183,73,179,160,182,167}
137+
[..##.] (0,3,4) (0,2) (0,1,2,3) (4) (2,4) (1,3,4) (0,1,2) {41,42,38,28,21}
138+
[####.#.#] (0,1,3,7) (0,1,2,3,4,7) (3,6) (1,2) (0,1,3,5,6,7) (0,4,5,6,7) (0,1,2,3,5,7) (4) (0,4) (0,2,3,4,5,6) {81,29,26,48,56,53,53,45}
139+
[#.##.#] (0,2) (0,1,2,5) (0,3,4,5) (0,3,4) (0,1,2) (0,1,2,4) (0,4,5) {85,35,43,24,45,44}
140+
[#.#####.#] (0,1,3,5,7) (0,1,2,3,4,5,8) (0,1,3,4,5,7) (0,2,3,4,5,6,8) (0,1,2,3) (0,1,4,6) (1,2,3,4,6,7,8) (0,1,4) (5,8) (0,1,2,4,5,6,7) {66,71,44,38,54,41,30,27,28}
141+
[####.] (0,2,3,4) (2) (1,2,3) (0,1) (1,4) (1) {12,42,20,11,12}
142+
[#..##.##.#] (0,2,3,6,7,8,9) (1,2,3,6,7,8) (1,2,5,6,8,9) (0,1,2,3,4,5,7,8,9) (0,1,3,8) (2,7) (0,1,2,4,7,9) (0,1,4,5,7) (0,1,2,3,4,5,7) (1,3,6,7) (0,1,2,3,5,7,8,9) {91,91,64,68,43,42,36,90,55,52}
143+
[###..####] (2,3,6) (0,1,2,3,4,7,8) (0,2,5,6) (0,2,4,5,6) (0,7,8) (1,2,3,6) (0,1,4) (0,1,2,3,4,5,7) (0,1,2,5,6,8) (0,4) (0,1,2,5,6,7,8) {254,32,71,46,232,38,56,33,21}
144+
[.....#.] (0,1,2,4,6) (2,3,5) (1,2,4,5) (2,4) (0,2,3,5,6) {6,9,37,17,20,26,6}
145+
[##..####] (0,1,4,5,6,7) (0,1,2,4,6,7) (0,1,2,3,5,7) (0,6) (2,5) (0,1,2,3,4,5,6) {52,45,52,22,37,39,44,31}
146+
[......#] (1,5,6) (2,3,4) (0,5) (0,2,3,4,5) (0,1,2,4,6) (1,2,4,6) (2,4,6) (0,2,3,4,5,6) (0,1,2,3,5) {39,31,46,31,40,46,34}
147+
[.######] (0) (0,1,6) (0,2) (1,3,5) (4,5) (1,3,4,5,6) (2,6) (0,1,2) (0,1,3,4,5) {88,71,41,37,180,196,25}
148+
[###..#....] (2,5,6,8) (1,3,6,7,8) (0,5,8,9) (4,5,7) (1,2) (3,5,9) (0,1,2,3,9) (5,7,8) {19,37,52,40,14,63,17,28,30,39}
149+
[##.#...#.] (1,2,7,8) (1,2,6) (4,6) (0,1,2,4,6,7,8) (0,2,3,5,6,7,8) (0,2,3) (0,1,2,4,5,6,7) {39,42,63,21,27,38,62,47,29}
150+
[.########.] (1,2,3,4,5,6,7,8) (0,2,4,5,6,7,8,9) (6,8) (0,1,2,4,6,7,9) (3,5) (0,1,3,6,7,8) (1,2,4,6,9) (2,3,6,7,8,9) (0,1,2,3,5,6,7,8,9) (0,1,3,5,8) {50,75,73,52,57,48,255,66,220,58}
151+
[..#.#..##] (0,2,4,5,7) (1,5,7,8) (0,1,5,6,7) (1,3,4,6) (1,2,5,6,7,8) (2,4) (2,4,7,8) (0,3,4,7) (0,3,5,6,7,8) (0,1,3) (0) {65,36,134,37,150,42,14,176,139}
152+

2025/10/main.go

Lines changed: 135 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,135 @@
1+
package main
2+
3+
import (
4+
"fmt"
5+
"io/ioutil"
6+
"strconv"
7+
"strings"
8+
)
9+
10+
type Machine struct {
11+
desiredState map[int]bool // desiredState as a map of [index]bool
12+
buttons [][]int
13+
joltage []int
14+
}
15+
16+
func copyMap(m map[int]bool) map[int]bool {
17+
out := map[int]bool{}
18+
for k, v := range m {
19+
out[k] = v
20+
}
21+
return out
22+
}
23+
24+
func applyButton(buttons []int, state map[int]bool) map[int]bool {
25+
for _, b := range buttons {
26+
state[b] = !state[b]
27+
}
28+
return state
29+
}
30+
31+
// minMoves determines min moves to reach the desired state, starting from all turned off..
32+
func (m Machine) minMoves() int {
33+
// can I short it heuristically?
34+
start := map[int]bool{}
35+
36+
// 100 is a heuristic lol
37+
minMoves := len(m.buttons) * 3
38+
var recurse func(map[int]bool, int)
39+
recurse = func(current map[int]bool, moves int) {
40+
if moves > minMoves || moves > minMoves {
41+
return
42+
}
43+
if stateEquals(current, m.desiredState) {
44+
minMoves = moves
45+
}
46+
for _, buttons := range m.buttons {
47+
recurse(applyButton(buttons, copyMap(current)), moves+1)
48+
}
49+
}
50+
recurse(start, 0)
51+
return minMoves
52+
53+
}
54+
55+
// stateEquals for all the values that are TRUE
56+
func stateEquals(m1, m2 map[int]bool) bool {
57+
for k, v := range m1 {
58+
if v == true && m2[k] != v {
59+
return false
60+
}
61+
}
62+
for k, v := range m2 {
63+
if v == true && m1[k] != v {
64+
return false
65+
}
66+
}
67+
return true
68+
}
69+
70+
func main() {
71+
machines := parse(readInput())
72+
fmt.Println(solve1(machines))
73+
}
74+
75+
func solve1(machines []Machine) int {
76+
min := 0
77+
LEN := len(machines)
78+
for i, m := range machines {
79+
fmt.Printf("processed: %v of %v\n", i, LEN)
80+
min += m.minMoves()
81+
}
82+
return min
83+
}
84+
85+
func parse(lines []string) []Machine {
86+
87+
parseDesiredState := func(in string) map[int]bool {
88+
out := map[int]bool{}
89+
for idx, s := range in[1 : len(in)-1] {
90+
out[idx] = s == '#'
91+
}
92+
return out
93+
}
94+
95+
parseJoltage := func(in string) []int {
96+
return nil
97+
}
98+
99+
parseButtons := func(in string) []int {
100+
trimmed := in[1 : len(in)-1]
101+
out := []int{}
102+
for _, p := range strings.Split(trimmed, ",") {
103+
num, err := strconv.Atoi(p)
104+
if err != nil {
105+
panic(err)
106+
}
107+
out = append(out, num)
108+
}
109+
110+
return out
111+
}
112+
113+
machines := []Machine{}
114+
for _, line := range lines {
115+
m := Machine{buttons: [][]int{}}
116+
if line == "" {
117+
continue
118+
}
119+
parts := strings.Split(line, " ")
120+
m.desiredState = parseDesiredState(parts[0])
121+
m.joltage = parseJoltage(parts[len(parts)-1])
122+
for i := 1; i < len(parts)-1; i++ {
123+
m.buttons = append(m.buttons, parseButtons(parts[i]))
124+
}
125+
machines = append(machines, m)
126+
}
127+
return machines
128+
}
129+
func readInput() []string {
130+
b, err := ioutil.ReadFile("input.txt")
131+
if err != nil {
132+
panic(err)
133+
}
134+
return strings.Split(string(b), "\n")
135+
}

2025/10/test_input.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[.##.] (3) (1,3) (2) (2,3) (0,2) (0,1) {3,5,4,7}
2+
[...#.] (0,2,3,4) (2,3) (0,4) (0,1,2) (1,2,3,4) {7,5,12,7,2}
3+
[.###.#] (0,1,2,3,4) (0,3,4) (0,1,2,4,5) (1,2) {10,11,11,5,10,5}

0 commit comments

Comments
 (0)