This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-12-11
Channels
- # adventofcode (42)
- # asami (13)
- # babashka (40)
- # beginners (25)
- # calva (39)
- # cider (18)
- # circleci (6)
- # cljs-dev (3)
- # clojure (39)
- # clojure-europe (16)
- # clojure-norway (9)
- # clojure-uk (2)
- # clojurescript (42)
- # datalevin (4)
- # datomic (23)
- # fulcro (33)
- # jobs (1)
- # malli (26)
- # minecraft (1)
- # off-topic (88)
- # pedestal (3)
- # polylith (8)
- # re-frame (6)
- # remote-jobs (2)
- # shadow-cljs (20)
- # tools-deps (12)
- # xtdb (5)
I needed Day 10. I still haven't been able to solve part 2 of Day 9 (I'm going to punt for now) even though I know how to solve it. I just can't seem to write an implementation that doesn't either short-cut in a way that breaks or blows out my stack in skipping shortcuts. But Day 10? That was built for Lispers.
agreed. day 10 was a joy
🧵Day 11 answers thread: post your answers here
Here we go https://github.com/zelark/AoC-2021/blob/main/src/zelark/aoc_2021/day_11.clj
https://github.com/tschady/advent-of-code/blob/main/src/aoc/2021/d11.clj 17ms / 28ms
not my most concise solution… avoids scanning the whole map any more than once per step by checking if an octopus is ready to flash at increment time and pushing it on a stack. lots of passing state around to make that work though. I was expecting part 2 to be “simulate for a really long time” 🤷 (I also didn’t look at the input and see that it was tiny )
13ms/42ms
https://github.com/callum-oakley/advent-of-code/blob/main/src/aoc/2021/11.clj
Day 11 https://github.com/RedPenguin101/aoc2021/blob/main/day11.md and https://github.com/RedPenguin101/aoc2021/blob/main/clojure/src/aoc2021/day11.clj One of those things where the code started out pretty messy, but I got into a 'virtuous spiral' of refactoring, ending up with a quite readable (I think) solution. Definitely not fast! But sub-second, which is good enough I think.
https://github.com/kfirmanty/advent-of-code-2021/blob/main/src/day11.clj - my first pass at solution - nothing fancy on my side, just plain loop
through the board but seems to do the trick and executes part-2 in 163ms
on my machine
https://github.com/kconner/advent-of-code/blob/master/2021/11a.clj, https://github.com/kconner/advent-of-code/blob/master/2021/11b.clj and yes you can use frequencies
🙂
https://github.com/genmeblog/advent-of-code/blob/master/src/advent_of_code_2021/day11.clj
Wrote mine last night, and then rewrote it this morning. I used a recursive cascade-flashes
function instead of keeping track of which points I had already flashed; it was a little less efficient than my original loop-recur
, but I think it looks cleaner.
• https://github.com/abyala/advent-2021-clojure/blob/main/docs/day11.md
• https://github.com/abyala/advent-2021-clojure/blob/main/src/advent_2021_clojure/day11.clj
My solution for today
I was really bummed that update-in
throws when given an invalid array position like [-1 0]
and at some point i learned that get-in
returns the whole coll if the key is nil
my basic solution: https://samadams.dev/2021/12/11/advent-of-code-day-11.html
Horrible solution by me today. For whatever reason I couldn't get my head around grids, so I represented it as a flat vector. I also think I compensated for my brain not working by building it into a way too complicated data structure. Each cell looked like this
{:n 0 :flashed false :flashes 0 :xy [0 0] :i 0}
I know, dumb.
BUt at least it's done, and it runs instantly.
https://gist.github.com/stuartstein777/65179a928273e201af0b256a7b024487#file-2021-day-11-clj-L7
Definitely one I need to rethink when my brain is working better and re-workI couldn't get to this yesterday. I expected second half to be harder; I was glad I had built step 1 on top of iterate
so I could just reuse it for step 2. I guess I could clean it up but I have to do day 12 first: https://github.com/euccastro/advent-of-code-2021/blob/main/day11.clj
Very cool, @U067R559Q! What did you use for visualization?
@U01HHBJ56J1 I didn’t do it. It is made by @UE27GJZR8 https://github.com/agrison/advent-of-code
I was just trying it out, it doesn't really help
Day 11 animation, it's flashing (epilepsy warning) so I hid it in a thread. Cubic interpolation is used to generate bigger image.
and code for that: https://github.com/genmeblog/advent-of-code/blob/master/src/advent_of_code_2021/day11.clj#L75
thanks for the threaded animation! looks very cool but nice to not have flashing by default
what's the plural of octopus? octopi?
it's complicated
https://www.merriam-webster.com/words-at-play/the-many-plurals-of-octopus-octopi-octopuses-octopodes