This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2023-12-20
Channels
- # adventofcode (23)
- # announcements (4)
- # babashka (1)
- # beginners (37)
- # biff (2)
- # calva (1)
- # cider (19)
- # clj-kondo (11)
- # clojure (45)
- # clojure-bay-area (2)
- # clojure-europe (12)
- # clojure-nl (1)
- # clojure-norway (15)
- # clojure-uk (2)
- # clojurescript (8)
- # conjure (1)
- # cursive (17)
- # datomic (11)
- # garden (1)
- # graalvm (4)
- # hyperfiddle (21)
- # java (10)
- # jobs (3)
- # lsp (23)
- # off-topic (18)
- # polylith (2)
- # re-frame (4)
- # releases (1)
- # remote-jobs (3)
- # rewrite-clj (4)
- # squint (44)
- # uncomplicate (1)
- # xtdb (84)
Day 20 — Solutions 🤪
I solved both parts, but need some times for rest and cleaning up my code. Actually I like it much more than yesterday’s one. I have good memories about microcircuitry classes in the university :face_holding_back_tears:
Yeah, here is my solution https://github.com/zelark/AoC/blob/master/src/zelark/aoc_2023/day_20.clj
I went with ugly global mutable state by just keeping track of the actions in two atoms. It is definitely not nice but helped keep the functions relatively small. https://github.com/erdos/advent-of-code/blob/master/2023/day20.clj
Better version, with colors. red - flip-flop, blue - conjunction. Made with https://graphviz.org/.
@U067R559Q Can you explain how LCM plays into this? I quickly realized I can't just keep pressing the button. I looked at your solution, but it's enough different from my core that I don't fully follow what the values passed to LCM are.
Let me explain. Each of the four conjunctions connected to the last one triggers in some cycle. You need to find them and common cycle.
Ah, I see. I need to identify those 4 and determine their cycle. Now, I just have to figure out how to do that with the code I already have 🙂. Thanks!
@UEF091BP0 I explained it more here https://www.reddit.com/r/adventofcode/comments/18mz6iy/2023_day_20_part_2_on_how_binary_counter_works/
About my way to find them, I take flip-flops connected right to the broadcast module. There are 4 as I observed. When a counter resets, it also resets an initial flip-flop from a branch (there is a back loop). It means if you find two adjacent states of the flip-flop with the same value (off off) you’ll find a loop.
OK, I've finished both parts now 🙂. Later, when I've commented the code, I'll post here.
Well https://github.com/wevre/advent-of-code/blob/master/src/advent_of_code/2023/day_20_pulses.clj was easy enough, but I don’t know if I ever would have figured out what was going on without insight from @U067R559Q
My numbers are also prime. It is common to AoC, they like prime numbers 🙂 So usually you just need to multiply them all
Here is https://github.com/alexalemi/advent/blob/main/2023/clojure/p20.clj , this one took quite a while.
https://github.com/genmeblog/advent-of-code/blob/master/src/advent_of_code_2023/day20.clj
Good and very challenging task! Finally got some profit of my custom graph visualisator 😄 https://github.com/Ivana-/star-dance
But I think actually to find the cycles is not enough for solving this task imho. You have to prove (or check, like I did) that all the needed pulses occurs on the same step of the pulse propagation during each push. Topology of that 4 subgraphs are similar, but the required (forces high level pulse on all the inputs of pre-last Conjunction module) steps sets inside push are different, thanks God they have non-empty intersection.
https://github.com/rjray/advent-2023-clojure/blob/master/src/advent_of_code/day20.clj Got my code commented. Been a long day at work...