David Wesst

DW Logo

Advent of Code 2021: Day 1

December 02, 2021
Categorized under build cool stuff
advent of codejavascriptnodejs

I decided to try and participate in the Advent of Code this year. This is my experience for Day 1.

If you’re looking for the repo, I have setup an Advent of Code repository on GitHub here on my profile.

Simple enough, but fun!

When you read through the first problem it has this little story about retrieving the keys to, what I assume is, Santa’s sleigh.

To do that, you need to get a bunch of stars by solving coding problems, two per day. Once you solve the first one, you get a star and you unlock an extension of the first problem for a second star.

Get all the stars, then a winner is you!

Initial Impressions

As advised by Chrinkus, day 1 is a warm up day. It gets you thinking and lets you get setup.

So, I did just that and accomplished the following:

  • Setup the repository.
  • Setup a basic project structure.
  • Re-learn some JavaScript/Node fundamentals and some of the newer features (i.e. ES Module support).
  • Solve the problem, like a boss.
  • Attempt and fail at setting up a dev container.

I did most of this over an hour or two, and it was a pretty satisfying experience overall.

Reflections

Looking at the day, I think I did a really good job to get myself started. Not only did I manage to complete the problem in Node v16, with ES Modules and the fs/promises API (which was all new to me), but I also managed to drop the dev container environment and not get hung up on silly things that don’t produce code, like the project folder structure.

These are things that I can improve as I go. Normally I’d do the “backlog” thing and create issues and get myself thinking about how I can improve things..but I’m breaking that distraction and disabled issues in the repo. Any feature, problem, or whatever need to be backed wth code, and I’ll do that with pull requests.

Conclusions

Today exceeded my expectations. Day 2 is already up. I’m not going to look at it right now as I need to get some sleep…but I’m pretty eager to take a peek and keep earning my stars.

Thanks for playing.

Screenshot from the NES game Pro Wrestling that shows a wrestler with his shirt off and arms up with the title 'A Winner is You' beneath him