Contents

Advent of Code 2021

Contents

In general, I regard myself as pretty bad at algorithms. I’m comfortable enough doing the Elixir track on Exercism (that’s how I learned Elixir), and I’ve used HackerRank some, but the reason I used HackerRank was because TripleByte said algorithms were my weak point. (It said architecture was my strong suit, and I’m quite pleased with that, as I did put effort into improving on that front.) I really dislike white boarding in job interviews (both because of the nerves factor and because the problems are usually totally unrelated to the job) and so much prefer take-homes.

So continuing the “get better at algorithms” thing that has me doing HackerRank, I’m trying Advent of Code this year. I think I heard about it from reading the updated version of The Pragmatic Programmer, but even if I didn’t, I still recommend that book. I totally forgot about it until December 1, though, so I went into Advent of Code with no prep.

I will never be on the leaderboard, and that’s fine. I can’t figure out how people understand the problem in under 5 minutes, let alone get the code written in that time.

I’ve found that most of the slacks I’m on have dedicated Advent of Code channels. Most use threads to contain discussion of individual problems so as not to spoil people who start late or want to do it 100% on their own. People post their solutions, and reading them is a good way to learn about other ways of thinking about problems and parts of your language’s standard library you didn’t know about. I’ve found folks in the Elixir slack particularly helpful, whether explaining some trick they used or providing additional test data. (On day 16, a puzzle involving parsing deeply nested data packets in binary, my code worked for the examples but crashed several thousand bits into my input data. Another Elixir person (Po Chen) kindly provided me his input, and it crashed my code nearly immediately; I could parse that much binary by hand to find the problem.) (This was, by the way, a task for which Elixir and Erlang are uniquely suited, since they can pattern-match on binary data.)

I’ve been enjoying watching José Valim’s livestreams each morning at 11am EST, where he solves each problem using only the Elixir standard library in a LiveBook instance. His code is typically concise but readable, and until day 16, he finished every problem in under an hour. José is the creator or Elixir, so his skill with the language is no surprise, but it’s still a thing to behold.

Something I’ve found fascinating is realizing that this impacts language development. Someone on the Erlang slack reported a compiler bug that one of their solutions found, and I came across a Rust user who’s improving Rust’s grid library after several puzzles involved using 4-neighbors and 8-neighbors. I even added a pair of new functions to the Elixir standard library.

However, I think this is the point where I bow out of Advent of Code 2021. I got through day 17. The puzzles get progressively harder, and this is the point in the month where the herd really thins out. I could probably still do 18, but I wrote 200 lines of code based on misunderstanding the problem, and I just don’t feel like it right now.

I’m going to go back and re-implement some previous puzzles in Erlang, since I’m learning Erlang for my new job. I already did one, but I haven’t committed it to my GitHub repo yet because I haven’t figured out how exactly I want to organize my Erlang code yet. (For the Elixir one, I’m using Mitchell Hanberg’s template project.)