Advent of Code 2015
Advent of Code 2015
I completed all fifty stars for Advent of Code 2015 in Go.
Solutions live in the bandarji/aoc repository under
go/adventofcode/. Each day below summarizes the puzzle and the approach in
my code.

Five Favorite Days
Here, I shall reveal the days I had the most fun coding. These do not represent the easiest nor the toughest, just which ones I enjoyed for some reason or another.
One: The Ideal Stocking Stuffer (Day 4)
To solve this one, the code had to prefix a string with a secret code, then append the string representation of an incrementing integer. The code would stop when the MD5 hash of that string started with five zeros. For the second part of the day’s puzzle, the code would stop when the hash started with six zeros.
> make run YEAR=2015 DAY=4
Year=2015 Day=04 Part 1: 282749 (119.333208ms)
Year=2015 Day=04 Part 2: 9962624 (3.486467s)
You can see that it took nearly ten million cycles to find the first six-zeroed hash. At some point in the future, I might write the MD5 hashing code from scratch.
Two: Doesn’t He Have Intern-Elves For This? (Day 5)
This puzzle comes down to getting if/then/else statements just right. I liked it that part two of the day’s puzzle did not require a rewrite.
> make run YEAR=2015 DAY=5
Year=2015 Day=05 Part 1: 238 (4.381416ms)
Year=2015 Day=05 Part 2: 69 (198.042µs)
Three: Elves Look, Elves Say (Day 10)
Wow, these strings got long in a hurry. Basically, a string of digits becomes a longer string of digits as their count gets read before their value. For example, 211 is read as “one two, two ones”, which becomes 1221.
> make run YEAR=2015 DAY=10
Year=2015 Day=10 Part 1: 360154 (5.681027042s)
Year=2015 Day=10 Part 2: 5103798 (13m29.418097s)
The execution times inform me that an optimized solution exists. I shall revisit this one to look for a better implementation. Thirteen minutes!
Four: Reindeer Olympics (Day 14)
Countdowns. Countdowns everywhere.
> make run YEAR=2015 DAY=14
Year=2015 Day=14 Part 1: 2655 (520.708µs)
Year=2015 Day=14 Part 2: 1059 (185.417µs)
Five: Opening the Turing Lock (Day 23)
I enjoy the puzzles where your code processes instructions. Gotta constantly watch out for off-by-one and out-of-index issues.
> make run YEAR=2015 DAY=23
Year=2015 Day=23 Part 1: 307 (392.25µs)
Year=2015 Day=23 Part 2: 160 (81.833µs)