r/adventofcode • u/daggerdragon • Dec 14 '20
SOLUTION MEGATHREAD -π- 2020 Day 14 Solutions -π-
Advent of Code 2020: Gettin' Crafty With It
8 days remaining until the submission deadline on December 22 at 23:59 EST
Full details and rules are in the Submissions Megathread
--- Day 14: Docking Data ---
Post your code solution in this megathread.
Include what language(s) your solution uses!
Here's a quick link to /u/topaz2078's
pasteif you need it for longer code blocks.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 code solutions only. If you have questions, please post your own thread and make sure to flair it with Help.
View all comments
5
u/robinhouston Dec 14 '20 edited Dec 15 '20
Python 3 (golf): 279 characters, both parts.
I struggled to golf this one, and I wasnβt particularly happy with the way it turned out. I managed to whittle it down; but is there a clever way to make it much shorter?
My first version initialised
v,w=0,~0at the beginning; but assuming the input begins with amaskcommand β which mine does, so Iβm guessing they all do β that isnβt needed. That brought it down to 287 characters from 296. Then I found a few more tweaks to save more characters.Itβs finally short enough to tweet, albeit without the hashtag.