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: 2021/README.md
+21-2Lines changed: 21 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -21,15 +21,16 @@ Description of what I'm doing. Contains spoilers....
21
21
2. Same function, but change the input for every char.
22
22
23
23
### 04.sh
24
-
1. Use an array to store all lines/rows of a bingo card. Delete numbers from all lines until a line is empty.
24
+
1. Use an array to store all lines/rows of a bingo card. Delete numbers from all lines until a line is empty.
25
25
2. Remove a card when a line is empty. Keep going until all cards are gone.
26
26
27
27
### 05.sh
28
28
1. Mark all points on the grid in a hash table. Return a count of points that are != 1.
29
29
2. Mark diagonals on a second hash table. Add the first hash table to it and return a count of points that are != 1.
30
30
31
31
### 06.sh
32
-
Store a count of the fishes each day in a circular buffer, with the current 0-day at n%9. Bash arrays are circular by default.
32
+
80 rounds can be done in half a second with string shenaningans, but 256 days would take terabytes of RAM, and lots of time.
33
+
Instead store a count of the fishes each day in a circular buffer, with the current 0-day at n%9. Bash arrays are circular by default.
33
34
34
35
### 07.sh
35
36
1. Use the median.
@@ -38,3 +39,21 @@ Description of what I'm doing. Contains spoilers....
38
39
### 08.sh
39
40
1. Simple grep to fish out the output digits and isolate the ones with 2-4 or 7 digits.
40
41
2. A damn bother, since the letters were scrambled. Assigned the numbers based on length. The 5-6 length ones got special handling, by checking the length after removing the letters that make up 4 and 7. That was enough to identify every one.
42
+
43
+
### 09.sh
44
+
1. For each line, go forward in the string while the next char is lower. Once you reach that, add a low point if all 4 neighbours are higher.
45
+
2. Clean out the map so that all numbers except edges and 9s are empty. Add each low point from part 1 with a different symbol.
46
+
Use terrible bash to grow the symbols until the whole map is filled. Count the size of each symbol block.
47
+
48
+
### 10.sh
49
+
Renamed the brackets for easier grok-ing, and so that I could assign values to each one.
50
+
1. Keep removing "innermost" bracket pairs until none remains, then remove opening brackets and sum up the values in the first column, if any.
51
+
2. Remove any string containing a closing bracket, reverse the rest. Instead of adding a closing bracket, add the value for each opening bracket at a time.
52
+
53
+
### 11.sh
54
+
1. Convert the map to a 1D array, and add -9999999 to the sides so I don\'t need to think about edges. Recursve function to flash the octopi.
55
+
2. Run until all fields flash at once.
56
+
57
+
### 12.sh
58
+
1. Brute force. Simplified version of the recursive functions of 2015 (9 and 13). Collect a hashmap wit the destinations for each cave. Remove "start" from the destinations to simplify coding.
59
+
2. Add a dumb check to allow the first lowercase cave twice. Takes way too long to run.
0 commit comments