Advent of Code - Day 11

 read in about 2 minutes

Day 11: Reactor

At this point I believe day ten had got into my head rendering day eleven way harder than it actually should have been. This section you’re in a reactor with a diagram like the following example.

aaa: you hhh
you: bbb ccc
bbb: ddd eee
ccc: ddd eee fff
ddd: ggg
eee: out
fff: out
ggg: out
hhh: ccc fff iii
iii: out

This is a list of devices and where the outputs are attached.

Part 1

Here we are asked to count the paths from you to out.

Splitting the input on the contents to the left and right of the “:” was straight forward enough. I stumbled quite a bit on getting the path count here partially due to the aforementioned block. I found a solution that used a recursive function starting at “you” and following every path and counting each one.

Part 2

Now with a new set of data we must find how many paths start with “svr” end at “out” and visit both “dac” and “fft”.

svr: aaa bbb
aaa: fft
fft: ccc
bbb: tty
tty: ccc
ccc: ddd eee
ddd: hub
hub: fff
eee: dac
dac: fff
fff: ggg hhh
ggg: out
hhh: out

The solution involves creating a dictionary item of a location and the ways to get to it. This is processed first with the initial state of starting with “svr” and going through “fft”. Because we don’t care which order “fft” and “dac” are accessed a similar count is performed from “dac”. From there we count how to get from “dac” to “out”.

I wish the example was a little more complicated as the jump from example to input is a bit larger than I’d like.

Christopher Himes

I'm Christopher Himes (he⁠/⁠him), an accomplished tech professional living in Metro Detroit. I'm currently looking for work as a product owner or developer.

More about me

Interactions

@adw99@mastodon.social@programming@newsmast.community

Comments

This blog uses a Mastodon and webmentions for comments. You can comment by replying on Mastodon/ActivityPub/Fediverse account or webmention.

Related Posts

Recent Posts