My day job doesn’t (normally) involve programming; (as is obvious) I don’t have as much time these days for hobby electronics and programming as I used to; and I really miss it.
So I was delighted when Kip introduced me to Advent of Code a few years ago. It’s a programming contest that releases a new puzzle each midnight (US eastern time; 23:00 my time) on the night that becomes December 1 through the night that becomes December 25. You work the puzzles at your own pace in whatever programming language you want (a few years ago, I did one puzzle’s heavy lifting in software and evaluated the dozen remaining results by eye) and the site checks your answers for correctness and shows you stats about your ranking within the global participants and within personal leaderboards of which you’re a member.
The puzzles are cute word problems and come with examples of input, logic, and output. Each participant is given a randomly- or algorithmically-generated input file, therefore a different correct output from other participants. (The algorithmic and programming expertise of the AoC creator/maintainer is hard to overstate.) When you upload a correct output to the first part of the puzzle, you’re given the problem for the second part of the puzzle to run on the same input — which often as not causes a rewrite if you used inadvisable programming shortcuts in your solution to the first part.
As always, I’ll be doing this year’s puzzles in Perl. I’m reasonably fluent in it; and of the languages in which I’m reasonably fluent, Perl is very, very good at processing input in the kinds of formats used in these puzzles. (But so is _____ ! Yes, but I’m not fluent in _____ !)
And I’ll be posting them here, discussing both the algorithmic approach I take to the puzzle and the Perl code that accomplishes it.
You might find the puzzles interesting. You might find my algorithms interesting. You might want to learn more Perl (although I doubt it). You might want to trash-talk Perl (and I just won’t approve your comments). You might want to elevate my Perl programming by showing me more concise, more idiomatic, faster, or more elegant ways of writing the same code (and I’ll be thrilled).
See you Friday evening or Saturday morning, when I have time to post Friday’s code.