Recurse Center, week 4: Advent of Code

December 5, 2020 • Reading time: 4 minutes

My initial plan for this week was to do some more work on RefCell, but I forgot that Tuesday was December 1, which means that Advent of Code 2020 is kicking off! I'd never heard of it before, but looking through past years piqued my interest, so I decided to use it as an excuse to improve my abysmal Python skills.

So far, the exercises have been fairly trivial for me, even in an unfamiliar language, which has left me with enough spare time to do some reading here and there or attend the occasional RC event, but not enough to really dive into anything else on the side. I have been focusing on rewriting my solutions to be more Pythonic, or to optimize my algorithms despite the relatively small data sets.

So far I've found Python to spark more frustration than joy, though I'm aware that I've only scratched the surface of what it means to be Pythonic. For one thing, getting a straight answer from the internet is a lot harder in Python than it is in Rust. If I could blacklist W3Schools from the DuckDuckGo search results, that'd be great. Rust's standard library documentation is impressively complete and has examples for every single function. Python, for all its focus on "there is only one (right) way to do it", seems much more fragmented, with a lot of my answers coming from Stack Overflow, where at least people can challenge and downvote incorrect answers. The various other sites that come up in my search results tend to give me answers that even I know are not idiomatic.

I understand why Rust's docs are so good: if you're trying to build traction for a new programming language in 2010, you need to make the onboaring process as painless as possible. I haven't spent much time in Go (yet), but I have the sense that its docs are similarly polished. I do have the sense that the situation was less dire with PHP too, but maybe that's just because I understood the language well enough that scrolling through the comments on php.net was a matter of perverse entertainment rather than genuine confusion.

Anyway, my project of learning Python is very much in its early days. If I can learn to love PHP, I can learn to love any programming language. I'm looking forward to having a sufficiently broad knowledge pool that I'll be able to reach for the right tool for the job instead of trying to force the wrong tool to do what I want it to, like the time I wrote an IRC bot in PHP. (Thankfully, the source for that one is lost to the pre-GitHub days.)

I did take a bit of time on Thursday to sketch out a roadmap for a project that's been banging around in my mind for a while: a D&D mapping tool that I'm tentatively calling Encounter. I've successfully pieced together giant ffmpeg commands to overlay grids on looping video in real time.

Dungeons and Dragons battle map video

(Map: Lava Lands by Dynamic Dungeons)

So my thinking is that I should be able to write an application that just wraps a pretty UI around those cryptic ffmpeg commands, and adds the ability to place and move virtual tokens for good measure. There are a lot of mapping tools out there, and they're all way too heavy for what I want. I might devote a few weeks to working on this in the new year.