My old friend Simon Breslav pointed me to Advent of Code a week or more ago, but at first I was hesitant. Where would I find the time to tackle a daily coding challenge that wasn’t related to work? Would I even be up to the challenge, given the fact I’m not coding full-time and may not be up-to-date with the latest techniques?
Here’s a speech by the creator of Advent of Code, Eric Wastl, where he talks about the origins of AoC from back in 2015, and how it’s gone from strength to strength since:
Anyway, come Friday evening I said to myself “go on, let’s see if I can catch up with this year’s event” and I immediately became hooked. I started off in Excel – easing my way into it – as much as anything to see at which point I’d hit the wall on needing a more mature coding environment: it turns out the answer is Day 4, which needed a slightly more complex data structure, and so I switched to JavaScript. That’s just my own choice, though: you could basically choose the programming environment of your choice, as long as it can read from a text file and output some results somehow.
For each day you get personalised input data, so while you might (I didn’t) copy code from the web to solve a challenge, you will need to run it on your own data to get the correct response for your login.
Here are the day-by-day challenges so far:
- Sonar Sweep
- Dive!
- Binary Diagnostic
- Giant Squid
- Hydrothermal Venture
- Lanternfish
- The Treachery of Whales
- Seven Segment Search
- Smoke Basin
- Syntax Scoring
- Dumbo Octopus
- Passage Pathing
- Transparent Origami
Each daily problem comes in two parts: the first is an introductory step that helps you map out the data structures you need, and to ease into the problem. It’s sometimes possible to make minor tweaks to your code to solve the second part, but sometimes – and this was certainly the case for Day 6 – a more radical change is needed. That particular challenge was really cool, because by the time you’d adjusted your approach to work for Part 2, you realised it was just so much better (and why on Earth hadn’t you thought of it before?).
To catch up with the first 12 days of challenges, I managed 3 on Friday evening, 5 on Saturday, and the last 4 on Sunday. Most of the challenges took less than an hour – the leaderboard has people solving them in a matter of minutes, but those folks must be “next level” – but some did take longer than expected, and sometimes for silly reasons such as not reading the instructions carefully enough. Oh well.
I’ve now completed Day 13, which I really enjoyed a lot.
Anyway, I do suggest having a go yourself, if you feel like brushing up on your coding skills with some fun (non-work) challenges. I’m honestly feeling invigorated from thinking about these problems over the weekend, and I’m looking forward to tackling the coming ones over the remainder of the month!