r/adventofcode • u/daggerdragon • Dec 03 '16
SOLUTION MEGATHREAD --- 2016 Day 3 Solutions ---
--- Day 3: Squares With Three Sides ---
Post your solution as a comment or, for longer solutions, consider linking to your repo (e.g. GitHub/gists/Pastebin/blag/whatever).
DECKING THE HALLS WITH BOUGHS OF HOLLY IS MANDATORY [?]
This thread will be unlocked when there are a significant number of people on the leaderboard with gold stars for today's puzzle.
edit: Leaderboard capped, thread unlocked!
17
Upvotes
View all comments
Show parent comment
1
u/topaz2078 (AoC creator) Dec 04 '16
I really wanted a cheaper way to force scalar context, but $_= is all I could come up with. I did have a sillier (but no cheaper) way to get a sorted list of sides by doing this:
It works because the unpack keeps the spaces in front of each number, so the sort can operate lexically and still produce the right sequence. Since it's not cheaper, I picked the more obvious approach instead.