adventofcode

Aleks 2021-12-20T04:46:03.233300Z

🧵Day 20 Solutions Thread: post your solution here

2021-12-20T07:10:41.234800Z

https://gitlab.com/maximoburrito/advent2021/-/blob/main/src/day20/main.clj I'd feel bad about the solution here, but after day 19 I'm just happy to be done

Aleks 2021-12-20T07:15:42.235100Z

Works for both demo and real inputs https://github.com/zelark/AoC-2021/blob/main/src/zelark/aoc_2021/day_20.clj

Aleks 2021-12-20T07:20:12.235400Z

@norman a hint about infinity is a blinking void

2021-12-20T07:31:12.239Z

Yeah, I had that but I was deferring to part 2 to figure how I needed to worry about it. I hacked around it and then found out part2 just needed a slightly larger constant in the hack... wheeee

Aleks 2021-12-20T07:32:21.239200Z

Yeah, I read your comments in the code 🙂

Antonio Bibiano 2021-12-20T11:05:56.239700Z

I was like, now way i need to light up infinitely many pixels..and indeed i needed to 😄

♾️ 2
Callum Oakley 2021-12-20T11:08:11.240Z

nice twist. part 2 is pretty slow but I need a break from optimising after yesterday… 😅 200ms/9s https://github.com/callum-oakley/advent-of-code/blob/main/src/aoc/2021/20.clj

👏 1
Antonio Bibiano 2021-12-20T12:14:22.240700Z

mhhh..went with adding a border that changes each iteration pretty slow for the second part, maybe there is something that I'm doing that is obviously slow?

Aleks 2021-12-20T12:31:58.241200Z

@antbbn actually you don’t need a border

Antonio Bibiano 2021-12-20T12:33:30.241400Z

yeah I could have gone with using a map for my grid, but i didn't want to iterate using indices, but probably that would have turned out better

Callum Oakley 2021-12-20T12:35:30.241600Z

I used the set of pixels that are on, or the set of pixels that are off. one of the two is always finite

kevinc 2021-12-20T16:10:57.243200Z

https://github.com/kconner/advent-of-code/blob/master/2021/20a.cljhttps://github.com/kconner/advent-of-code/blob/master/2021/20b.clj. 75ms and 10s. Instead of computing a number for each group of 9 pixels in an enhancement pass and using that to look up, which I supposed might be a bottleneck, I built the groups into the lookup table and used it as the lookup object. I don't know if that's actually faster in the end.

tschady 2021-12-20T17:39:57.243600Z

same kind of solution as others. 95ms / 5s https://github.com/tschady/advent-of-code/blob/main/doc/2021.adoc#aoc2021d20 Only interesting thing I do is :field (cycle [\0 \1]) and (update :field rest) to oscillate between values at infinity.

2021-12-20T20:35:48.244200Z

https://github.com/kfirmanty/advent-of-code-2021/blob/main/src/day20.clj went for a quick and dirty solution for day20. As in my lookup table first pixel was # and last . I just assumed that infinite board periodically flashes so each turn I alternated between either getting # or . when reaching outside of the board

Sam Adams 2021-12-20T21:03:15.244500Z

Especially gross code, hacky perimeter-flash logic — hoping to catch up today since I missed the last two days. https://samadams.dev/2021/12/20/advent-of-code-day-20.html

👍 4