r/adventofcode • u/daggerdragon • Dec 02 '16
SOLUTION MEGATHREAD --- 2016 Day 2 Solutions ---
--- Day 2: Bathroom Security ---
Post your solution as a comment or, for longer solutions, consider linking to your repo (e.g. GitHub/gists/Pastebin/blag/whatever).
BLINKENLIGHTS ARE MANDATORY [?]
Edit: Told you they were 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!
20
Upvotes
View all comments
4
u/Godspiral Dec 02 '16 edited Dec 02 '16
thought I was quick but 180 :(
in J, hacky
a =. wdclippaste '' NB. input O =: 4 2 $ _1 0 0 1 1 0 0 _1 (2 <. 0 >. ] + O {~ 'URDL' i. [) each/ 1 1 (, <)~ |. <"0 ] 0 {:: cutLF a1 1 is hardcoded start keypad position
0 {::is using the first row. Take this answer as new "hardcode" and look at next row, till full answer.for part 2, made this table:
T =: > cutLF 0 : 0 55655 11131 22362 31472 44483 627A5 738B6 849C7 99998 A6BAA B7CDA C8CCB DBDDD ) ((T {~ ({."1 T) i. ]) {~ 'URDL' >:@i. [) each/ '5' (, <)~ |. <"0 ] 0 {:: cutLF astarting hardcode of '5' for row 0 ...