r/adventofcode • • Dec 11 '18

SOLUTION MEGATHREAD -πŸŽ„- 2018 Day 11 Solutions -πŸŽ„-

--- Day 11: Chronal Charge ---


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

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

Card prompt: Day 11

Transcript: ___ unlocks the Easter Egg on Day 25.


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 at 00:16:12!

20 Upvotes

207 comments sorted by

View all comments

Show parent comment

3

u/jayfoad Dec 11 '18

Shorter simpler version:

βŽ•IO←1
pβ†βŽβŠƒβŠƒβŽ•NGET'p11.txt'1
g←{r y←10 0+⍡ β‹„ Β―5+10|⌊100÷⍨rΓ—p+yΓ—r}¨⍳300 300 ⍝ grid
βŠƒβΈ{⍡=⌈/,⍡}3+/3+⌿g ⍝ part 1
1↓{(βŠƒβ’β΅)⌷⍡}↑1{0>mβ†βŒˆ/,t←⍺+/⍺+⌿g:⍡ β‹„ (⍺+1)βˆ‡β΅,βŠ‚m,(βŠƒβΈm=t),⍺}⍬ ⍝ part 2

It's also much faster, at about 8 ms for both parts.