This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-12-20
Channels
- # adventofcode (17)
- # announcements (1)
- # aws (1)
- # beginners (102)
- # calva (27)
- # cider (16)
- # clj-commons (34)
- # clj-kondo (33)
- # cljs-dev (5)
- # cljsrn (4)
- # clojure (124)
- # clojure-europe (17)
- # clojure-nl (8)
- # clojure-spec (13)
- # clojure-uk (6)
- # clojurescript (68)
- # datahike (21)
- # datomic (23)
- # emacs (3)
- # fulcro (30)
- # introduce-yourself (6)
- # jobs-discuss (6)
- # lsp (31)
- # nextjournal (3)
- # off-topic (1)
- # other-languages (45)
- # portal (4)
- # re-frame (8)
- # releases (4)
- # shadow-cljs (39)
- # specter (6)
- # tools-build (18)
- # tools-deps (11)
🧵Day 20 Solutions Thread: post your solution here
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
Works for both demo and real inputs https://github.com/zelark/AoC-2021/blob/main/src/zelark/aoc_2021/day_20.clj
@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 🙂
I was like, now way i need to light up infinitely many pixels..and indeed i needed to 😄
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
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
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
I used the set of pixels that are on, or the set of pixels that are off. one of the two is always finite
https://github.com/genmeblog/advent-of-code/blob/master/src/advent_of_code_2021/day20.clj
https://github.com/kconner/advent-of-code/blob/master/2021/20a.clj, https://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.
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.
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
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