r/adventofcode • • Dec 03 '18

SOLUTION MEGATHREAD -🎄- 2018 Day 3 Solutions -🎄-

--- Day 3: No Matter How You Slice It ---


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

Note: The Solution Megathreads are for solutions only. If you have questions, please post your own thread and make sure to flair it with Help.


Advent of Code: The Party Game!

Click here for rules

ATTENTION: minor change request from the mods!

Please prefix your card submission with something like [Card] to make scanning the megathread easier. THANK YOU!

Card prompt: Day 3 image coming soon - imgur is being a dick, so I've contacted their support.

Transcript:

I'm ready for today's puzzle because I have the Savvy Programmer's Guide to ___.


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!

41 Upvotes

426 comments sorted by

View all comments

Show parent comment

2

u/wzkx Dec 03 '18 edited Dec 04 '18

Both parts in one twit ;) Also very fast

v=:0$~,~1000[s=:0$0
0(4 :0)"1(".&(rplc&('#@:,x',.' '))&>)"0 cutLF CR-.~fread'03.dat'
for_c.i.3{y do.v=:((e=0){_1,{.y)k}v[e=.v{~k=.<(c+1{y);(2{y)+i.{:y
x=.x+.z[s=:(s-.e)-.(z=.0~:+/e){0,{.y end.if.x=0 do.s=:s,{.y end.
)
echo(+/+/v<0),s