DEV Community

Eduardo
Eduardo

Posted on • Updated on • Originally published at eduherminio.github.io

Getting ready for Advent of Code 2020

What's all the fuzz about

It's almost December and Advent of Code is back! For those of you who don't know it yet, AoC is an initiative by the great Eric Wastl that consists of a series of 25 puzzles released daily between 1st and 25th of December.

In 2019 almost 100,000 people completed at least one of the two parts of the first problem and almost 3,000 of them completed them all; and I expect those numbers to increase this year due to the multiple lock-downs/stay-at-home recommendations in place worldwide.

People use Advent of Code as an excuse to learn a new language or paradigm, challenge their friends/colleagues (it has public and private leaderboards) or simply challenge themselves every day for a few minutes/hours and starting or ending the day with the satisfaction of getting stuff done.

Advent of Code 2015 gif animation

However, AoC is not only about solving problems, but also about learning from (or directly admiring) other people's solutions and creativity:

But please don't let those amazing examples intimidate you, most of us solve the problems in more down-to-earth ways and just enjoy reading about other people's solutions afterwards. And of once a problem is out, you can solve whenever you find time for it, not only during that day (or year!).

You can listen to this inspiring talk by Eric himself where he speaks about why he decided to organize it for the first time, the unexpected success he got the first advent day of the first year (his estimation about the number of participants was of by... 5,600% after the first 12 hours), how he keeps preparing it every year and the amazing community that has arisen around it.

My personal Advent of Code preparation

As stated, the beauty of Advent of Code is that each individual does it in their own way.

In my case, I don't focus on competing in any leaderboards, but just having fun writing some code and trying to make it both understandable and relatively performant.

I discovered AoC in 2018, and that same year while going through the problems I started creating some kind of 'mini-framework' for solving AoC problems using .NET.

I have to admit I had almost as much fun solving the actual problems as I did writing that util, which I released in 2019 as AoCHelper NuGet library.

This year I've tried to improve AoCHelper before starting the actual problem solving, to try to focus on finding the solutions to those problems rather than on tweaking the framework, but we'll see πŸ˜‰.
And yeah, that has been all my 'preparation'.

In case anyone is curious about it, here you can see the entrypoint to my console app (on the left) and how all my problem classes look like (on the right).

Personal workspace while using AoCHelper library: main program class on the left and problem class on the right

If I name the problem classes correctly and have the input files in the right folder, I just need to invoke:

using AoCHelper;

Solver.SolveAll();
Enter fullscreen mode Exit fullscreen mode

and I'll get some output that measured the performance of each solution:

Console output showing a table with the solution to multiple problems and the elapsed time that took to solve each one

EDIT

I've also created this GitHub repository template to allow anyone to quickly start solving puzzles.

Come join us 😏

There are tons of tools like mine out there written in/for multiple languages, and honestly most people don't bother or care about doing anything like that, because the only thing that adventofcode.com needs is final solution to the problem!

For the last two years this repo has been aggregating other repositories with solutions and utilities in different languages: Python, JS, TS, Ruby, Java, C++, Ada, Clojure, Prolog and a long etc. You can go there and just have a look, or open a PR to share your own ones!

After all that wording, did I manage to convince you to challenge yourself or your classmates/friends/colleagues from December 1st?


PD: Feel free to share your private leaderboard code in the comments if you want other DEV users to join you there!

Top comments (0)