Advent of Code

Anybody here doing the 2020 Challenge?

Cute. In a perversion of all that is holy, I’ve started doing them using Excel (no VBA). If the text processing gets too annoying, though, I’ll fall back to Python.

Heh, I’ve already done 6 in Excel.

I’m trying to see how far I can get without using VBA.

I did use a data table for one so far, just because I didn’t want to waste space making a big (600x600) table.

I am doing it using this year. I was doing well in a private leaderboard with other Julia people but the midnight start got old after the first 5 days.

1 Like

Ok, got through all 10 posted to date (20 stars) using Excel sans VBA. Used a matrix trick to avoid having to deal with iteration in one of them (the nested bag one); inverting the 594x594 matrix got Excel chugging for a sec, but the approach was too cute not to use (since in one fell swoop it gave the answers to parts 1 & 2 for every starting bag). The text parsing was really tedious in that one, though.

1 Like

Yeah, I’ve really gotten a workout with the text functions with the input… and having to deal with plural/singular “bags/bag” was annoying.

Wow are today’s tasks not Excel-friendly. Maybe I missed a trick, but iterating very large cellular automata without actually having loops… very unpleasant.

Amazingly, Excel didn’t crash on me, even though I had to be using on the order of a million cells (on the order of 100 iterations of a 100x100 CA).

Yeaaaaah, I don’t want to use Excel for today’s. I’ll probably do that one in python.

Though, thinking about it more, I have an idea of doing it in Excel.

It will be ugly, to be sure.

I’m going to use their example to test out the idea.

Okay, part 1 is okay for Excel w/o VBA, but now I have to think about part 2

Hmm. I may have to give up on using Excel for this; it’s just getting too annoying. Just did day 13 in Excel and ran up against an odd (but evidently previously known) error – if a >= 1,125,900,000,000 * b then MOD(a, b) throws a #NUM! error. (The particular multiplier that causes the issue seems to have varied with Excel versions, but that seems to be the one that causes a problem in my version of Office 365.)

I worked around it, but it’s much easier to do integral arithmetic using something that’s actually reliable – like Python’s built-in (unbounded) integer type.

I like this visualization of the colored bags problem:

from reddit:

Thanks for posting about this! I burned through a bunch of them this weekend. Got stuck on 14b (masking) with a dumb error where I gaffed my binary translation and eliminated all odd numbers from existence. Broke through on that last night.

Almost gave up when I saw 15b (memory game), but Excel VBA actually did STUNNINGLY well working with a 300M long array. Good thing since I had to run it through about a dozen iterations before realizing I only needed to worry about a max 30M, not 300M, potential values. :man_facepalming:

I’ve given up on using Excel for this – I did one of the days in Python, realized that was a heck of a lot more fun, and never went back. To preserve my sense of geek my dev box is a Raspberry Pi2 that’s buried somewhere on my desk and I VNC into. Unfortunately I haven’t updated the OS in years, so numpy won’t install. Which is annoying enough that tomorrow I’m going to head out into the apocalypse, buy a microSD card, image it with the latest OS and then reinstall my dev environment.

All so I can do silly programming problems about the North Pole IT lackey’s vacation woes on a computer that has less processing power than my phone. Using vi and an xterm (technically rxvt). So my weekend’s going to be pretty sweet. :nerd_face:

Hmm. The last two tasks (19 & 20) were a bit more involved, and according to the Stats page the number of completions has dropped pretty substantially. (Though it’s still early goings for day 20.)

The statement of the Day 20 problem annoyed me. If you don’t make certain unstated assumptions about the inputs — which fortunately happen to hold, and admittedly can be verified with just a little work — then your algorithm would need to be a fair bit more sophisticated. (Of course you also could just do the whole thing by hand.)

This was fun. Needed a tip for a couple of Part 2 puzzles, but managed the rest. Got very good at using dictionaries for a form of memoization. Should really learn to use the decorator properly.

Anyone know of any other projects/games like this? (besides Project Euler. Done what I can there, so what’s left is less fun and more work.) It’s a good way to take a break in the day and keep sharp.

1 Like

Hackerrank has various challenges, of various levels of difficulty.

1 Like

2021 challenge:

Here is a visualization of the top 100 fastest times by problem. Can be helpful to gauge the relative difficulty of individual problems:

(Yes, those times are in minutes and seconds)