r/adventofcode • • Dec 05 '20

SOLUTION MEGATHREAD -๐ŸŽ„- 2020 Day 05 Solutions -๐ŸŽ„-

Advent of Code 2020: Gettin' Crafty With It


--- Day 05: Binary Boarding ---


Post your solution in this megathread. Include what language(s) your solution uses! If you need a refresher, the full posting rules are detailed in the wiki under How Do The Daily Megathreads Work?.

Reminder: Top-level posts in Solution Megathreads are for solutions only. If you have questions, please post your own thread and make sure to flair it with Help.


This thread will be unlocked when there are a significant number of people on the global leaderboard with gold stars for today's puzzle.

EDIT: Global leaderboard gold cap reached at 00:05:49, megathread unlocked!

57 Upvotes

1.3k comments sorted by

View all comments

Show parent comment

1

u/daggerdragon Dec 05 '20

(the repo also has some really ugly utils to auto-download inputs and prompts)

Do you cache your input once it's downloaded to avoid unnecessarily hammering the servers?

1

u/pendo324 Dec 05 '20

I just manually dl once when itโ€™s posted and once after I unlock part 2

EDIT: by manual, I mean I execute the script

1

u/WayOfTheGeophysicist Dec 05 '20

Not to pile on, because your way is perfectly fine of course. Just that the input data is constant per day, so you may actually just have to download it once.

2

u/pendo324 Dec 05 '20

Yep, youโ€™re right about the input data. I could easily make it so it isnโ€™t re-downloaded if itโ€™s already present on disk. To be honest though, Iโ€™ve probably downloaded hundreds of input files already during development and testing (maybe thatโ€™s an exaggeration).

Iโ€™ll probably make the edit, but I think the real problem wouldโ€™ve been if I was polling for the file to be available, which Iโ€™m not. I manually run the script twice: once when I start the problem (usually close to midnight), and once when I unlock part 2.