Advent of Code 2021
It's December again and like so many years before this, I've picked up Advent of Code to help Santa and the elves to save Christmas.
What's Advent of Code?
Advent of Code is an annual programming puzzle advent calendar that's been running since 2015, created by Eric Wastl. Well, actually they are not necessarily programming puzzles but most often easiest to solve by the power of computing.
Each day, you'll get a puzzle, for example from day 1, 2020:
Before you leave, the Elves in accounting just need you to fix your expense report (your puzzle input); apparently, something isn't quite adding up.
Specifically, they need you to find the two entries that sum to
2020and then multiply those two numbers together.
For example, suppose your expense report contained the following:
1721 979 366 299 675 1456
In this list, the two entries that sum to
299. Multiplying them together produces
1721 * 299 = 514579, so the correct answer is
Each puzzle contains of alphanumeric input that is generated for each user and an output that is posted to the website to see if you solved it.
That variety opens up the floor to a lot of different approaches and over 100k developers solve Advent of Code puzzles every year in so many different ways.
Once you solve a puzzle, you're given a second part: often the same puzzle with a new twist that requires you to rethink your solution.
I especially love the community aspect of Advent of Code. Pretty much every developer community I'm involved it has a channel in Slack or Discord or threads in forums where people solve puzzles, showcase their solutions and discuss them.
Python & Jupyter Notebooks for 2021
Last year I took the opportunity to start learning a new language, Rust. It was a nice choice as I ended up learning the basics of Rust and continuing to this year to build my first Rust program.
However, it was also very challenging because not only did I need to solve increasingly difficult puzzles, I had to learn a totally new language and eventually I ended up with 15 stars and had to give up.
This year I decided to focus on two things: learning how to use Jupyter Notebooks with Python and focusing on writing blog/tutorial style thoughts of my solutions. I'm already comfortable coding with Python which opens up a lot of room for learning something new. I've tried Jupyter Notebooks a few times but mostly just fiddling around and wanted to see what I could do with them.
And while writing isn't a new thing for me, it's a thing I have so much to learn and room for improvement. So far, my approach has been writing down my thoughts and how I approach solving the puzzles while sharing tidbits of Python knowledge to help the reader learn a bit more about the language and its ecosystem.
I share my solutions at hamatti/adventofcode-2021 in GitHub. I really like how GitHub renders the Jupyter Notebooks in a nice readable form, making it easy for anyone to follow. Once this year's Advent of Code (or my participation in it) is done, I'll migrate the notebooks under this website.
Sign up for Syntax Error, a monthly newsletter that helps developers turn a stressful debugging situation into a joyful exploration.