Fork me on GitHub

🧵Day 20 Solutions Thread: post your solution here

norman07:12:41 I'd feel bad about the solution here, but after day 19 I'm just happy to be done


@U0954HGDQ a hint about infinity is a blinking void


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


Yeah, I read your comments in the code 🙂

Antonio Bibiano11:12:56

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

♾️ 2
Callum Oakley11:12:11

nice twist. part 2 is pretty slow but I need a break from optimising after yesterday… 😅 200ms/9s

👏 1
Antonio Bibiano12:12:22

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?


@U01HY37QQUA actually you don’t need a border

Antonio Bibiano12:12:30

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 Oakley12:12:30

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

kevinc16:12:57 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.


same kind of solution as others. 95ms / 5s Only interesting thing I do is :field (cycle [\0 \1]) and (update :field rest) to oscillate between values at infinity.

karol20:12:48 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 Adams21:12:15

Especially gross code, hacky perimeter-flash logic — hoping to catch up today since I missed the last two days.

👍 4