You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+6-6Lines changed: 6 additions & 6 deletions
Original file line number
Diff line number
Diff line change
@@ -4,6 +4,7 @@ https://adventofcode.com/2020/
4
4
5
5
Input not included, but can be given on the command line.
6
6
Defaults to *number*.txt in the same folder (no leading 0).
7
+
Setting env variable PUREBASH to any value (or giving a second argument) will use slow bash instead of using faster awk in days 15 and 25.
7
8
8
9
Description of what I'm doing. Contains spoilers....
9
10
@@ -74,9 +75,9 @@ Description of what I'm doing. Contains spoilers....
74
75
75
76
### 15.sh
76
77
1. Store the last known position in a sparse array. Calculate next position until done.
77
-
2. Finally bash fails. Sparse arrays in bash seem to be linked lists, so accessing/adding an item is O\[Nlog(N)\] or worse.
78
+
2. Finally bash fails. Sparse arrays in bash seem to be linked lists, so accessing/adding an item is O\[N\] or worse.
78
79
Gave up after 20 hours getting to item 6.1M, and solved it in 10-12 seconds with awk.
79
-
Using a sharded-set https://github.com/romkatv/advent-of-code-2019 solves this in about half an hour.
80
+
Using a sharded-set https://github.com/romkatv/advent-of-code-2019 solves this in about 20 minutes.
80
81
81
82
### 16.sh
82
83
1. Find the min/max of the classes, then loop through every ticket to find illegal values.
@@ -98,9 +99,8 @@ Description of what I'm doing. Contains spoilers....
98
99
2. Cheat a bit and use regex{n} to denote repeated matches.
99
100
100
101
### 20.sh
101
-
1. Slice and dice all permutations of the edges into arrays. Grep each tile against all permutations of edges.
102
-
The ones with only 6 matches are corners. The ones with 7 are edges.
103
-
2. Tile matching 144 pieces. Nope...
102
+
1. Slice and dice all permutations of the edges into arrays. Grep each tile against all permutations of edges. Convert line number to index/rotation. The ones with only 2 matches are corners. The ones with 3 are edges. Use that to assemble the image.
103
+
2. Not done yet: Once the picture is assembled, use a multi-line regex to find the monsters. Then count.
104
104
105
105
### 21.sh
106
106
Grep, sort, count
@@ -121,5 +121,5 @@ Description of what I'm doing. Contains spoilers....
121
121
122
122
### 25.sh
123
123
1. A couple of while loops. Yay.
124
-
2. I need to complete 17, 20-2 and 24-2 to get this one. Nope.
0 commit comments