Skip to content

Commit 41b57e6

Browse files
committed
README: Add highlights
1 parent 100fd06 commit 41b57e6

File tree

1 file changed

+60
-0
lines changed

1 file changed

+60
-0
lines changed

README.md

+60
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,66 @@ Some may additionally support other ways:
5656
* 19 (Josephus): Pass the number of elves in ARGV.
5757
* 22 (Grid Computing): To show the map, use the `-m` flag.
5858

59+
# Highlights
60+
61+
Solutions with interesting algorithmic choices:
62+
63+
* 11 (Chips and Generators):
64+
Plain breadth-first search, but pruning equivalent states since all generator-microchip pairs are indistinguishable from one another.
65+
I [explained on Reddit](https://www.reddit.com/r/adventofcode/comments/5hoia9/2016_day_11_solutions/db1v1ws/).
66+
Note that there are [implementations](https://www.reddit.com/r/adventofcode/comments/5i1blt/2016_day_11_c_both_parts_in_10_milliseconds/) using even more compact representations that allow bitwise operations to check move legality.
67+
* 15 (Timing Discs):
68+
Modular arithmetic, using modular inverses to determine how far each disc must spin, and noting that further alignments only happen at the LCM of the periods.
69+
* 16 (Dragon Checksum):
70+
Every full (input + input reversed and negated) pair is known to increase the number of ones by exactly the size of the input, so the only things left are to deal with partial chunks and to calculate the parity of the Dragon sequence.
71+
I [discussed on Reddit](https://www.reddit.com/r/adventofcode/comments/5imh3d/2016_day_16_solutions/db9erfp/), leading to [my method of calculating Dragon parity in O(log n)](https://www.reddit.com/r/adventofcode/comments/5imh3d/2016_day_16_solutions/db9w7im/).
72+
Before I had even discovered that, askalski had already [taken to the next level](https://www.reddit.com/r/adventofcode/comments/5ititq/2016_day_16_c_how_to_tame_your_dragon_in_under_a/) by finding Dragon parity in O(1) time.
73+
* 18 (It's a Trap!):
74+
It's left XOR right.
75+
* 19 (Josephus):
76+
Mostly explained in comments, but it started with me [musing on Reddit](https://www.reddit.com/r/adventofcode/comments/5j4lp1/2016_day_19_solutions/dbdh7i2/) how to determine the winner of N from N - 1 and going from there.
77+
* 21 (Scrambled Passwords):
78+
Undo each operation rather than brute-forcing. Note that "rotate based on position" is quite interesting.
79+
* 22 (Grid Computing):
80+
Naively move the empty space to the top, then use math to figure out how many steps it takes to move it to the side, assuming no walls in the top two rows.
81+
* 12, 23, 25 (Assembunny):
82+
Optimises out sequences of the form:
83+
* `x += y`
84+
* `x += y * z`
85+
* `q, r = x / d, d - (x % d)` (only applicable for 25)
86+
87+
Solutions notable for good leaderboard-related reasons:
88+
89+
* 8 (Two-Factor Authentication): A [leaderboard](http://adventofcode.com/2016/leaderboard/day/8) performance that I have **never** matched since, not even in 2017!
90+
91+
Solutions notable for bad leaderboard-related reasons:
92+
93+
* 7 (IPv7):
94+
Reading comprehension failure: read "doesn't contain an ABBA in brackets" as "ignore any ABBA in brackets" so falsely accepted `abba[abba]`.
95+
* 12 (Assembunny): Lost time on easy mistakes:
96+
* Accidentally making decrement increment, because of copy-and-paste coding.
97+
* Having JNZ do nothing when the register was 0 (just repeatedly executing the same JNZ) instead of advancing the PC.
98+
* 13 (Maze) part 2:
99+
A silly bug (`wall?(x, y)` instead of `wall?(nx, ny)`) meant walls were visitable but with no neighbours, giving a correct answer for part 1 but an incorrect answer for part 2.
100+
Significant time loss debugging this, including time lost assuming that I was right and the site was wrong.
101+
Only found out something was wrong by printing out all visited non-walls with O and realising that the count of Os was different than the visited count that the code reported.
102+
* 14 (One-Time Pad):
103+
Noted in comments; premature optimisation led to buggy solution.
104+
* 16 (Dragon Checksum) part 2:
105+
Used string instead of bool.
106+
Ran out of memory and had to reboot computer.
107+
* 23 (Assembunny II):
108+
Attempted to use Assembunny to C translator, seeing too late that `tgl` was specifically designed to prevent it.
109+
[Didn't stop askalski from doing it anyway](https://www.reddit.com/r/adventofcode/comments/5jvbzt/2016_day_23_solutions/dbjbnbl/).
110+
Assembunny I code was not in reasonable shape to be reused easily.
111+
Lesson learned: Ensure all code is reasonably extensible.
112+
* 24 (Hamiltonian):
113+
Used `OPEN[ny, nx]` instead of `OPEN[ny][nx]`, meaning robot was ignoring all walls.
114+
Once again, assumed I was right and site was wrong.
115+
Printing out paths robot is taking made this clear.
116+
Statically-checked types would have helped, since `OPEN[ny, nx]` is of type `[bool]` whereas `OPEN[ny][nx]` is of type `bool`.
117+
On the bright side, I learn about `array[start, length]` and thus use it intentionally many times in 2017.
118+
59119
# Posting schedule and policy
60120

61121
Before I post my day N solution, the day N leaderboard **must** be full.

0 commit comments

Comments
 (0)