r/adventofcode • • Dec 04 '16

SOLUTION MEGATHREAD --- 2016 Day 4 Solutions ---

--- Day 4: Security Through Obscurity ---

Post your solution as a comment or, for longer solutions, consider linking to your repo (e.g. GitHub/gists/Pastebin/blag/whatever).


CONSTRUCTING ADDITIONAL PYLONS 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!

19 Upvotes

168 comments sorted by

View all comments

Show parent comment

2

u/AoC-- Dec 04 '16 edited Dec 04 '16

Pretty much the same as above, but squished into three lines. This only works in oK because of the problem mentioned above, and because AW's k wants ({}.)'l as opposed to {}.'l.

l:({(,/-1_x;.*|x;-1_*y)}."-"\'"["\)'0:"04.in" /load and parse input
+/{y*z~5#>(26*x)-!x:#:'=x}.'l                 /part 1
+/{z;y*13=*26!y+x-97}.'l                      /part 2

This seems to end up being 101 characters, as opposed to the 117 characters above, because a few characters were saved with parsing.

Characters were counted using cat 04.k | sed 's/^ *//;s/ *\( \/.*\)*$//;s/: /:/g' | grep . | wc -c.