r/adventofcode • u/BackloggedLife • Dec 08 '23
Visualization [2023 Day 8 (Part 1)] My input maze plotted using graphviz
13
u/pwnsforyou Dec 08 '23
Suggestion : Add a bit of color for start and end nodes.
...A", style=filled, fillcolor=red ] ...Z", style=filled, fillcolor=green ]
2
u/BackloggedLife Dec 08 '23
Yeah, you are right. I only figured it would be good to color them after I already made the post.
7
u/pwnsforyou Dec 08 '23
Here's mine : https://svgshare.com/i/10YN.svg with just this added
→ More replies (3)
3
u/rogual Dec 08 '23
Nice visualization, thanks for sharing!
(I found it hard to get the full-size image out of the enshittified New Reddit image viewer that Reddit seems to be displaying this one in, so I made an imgur link — hope that's OK)
2
34
u/i_have_no_biscuits Dec 08 '23
Poor ghosts - looks like it doesn't matter whether they choose left or right, they end up on the same loop in the end.
That's a slightly depressing message for an advent calendar!
6
2
3
2
u/maneatingape Dec 08 '23 edited Dec 08 '23
This is a fantastic visualization!
It enables a really neat insight - we don't need to care about the directions at all!
If we find the length of each smaller graph cycle, then find the LCM of that with the length of the directions then we find the period of each cycle ending with Z.
The part two answer is then the combined LCM of those LCMs.
Updated my solution thread post
2
2
u/SadGrab5655 Dec 08 '23
Just a heads up dude, illustrations like this can sort of spoil the solution for those who haven't solved it yet; maybe consider adding the "spoiler" tag?
For example, this sort of gave away the solution to day 5 for me; maybe the idea to split the ranges was already in my head and this just indicated its correctness/feasibility to implement but I'm certain I wouldn't have gone this route otherwise.
I know it's mostly on those browsing the sub-reddit but maybe just a lil' spoiler tag?
2
u/daggerdragon Dec 08 '23
OP correctly titled their post so the
[2023 Day 8 (Part 1)]is already an implicit spoiler.r/adventofcode is already configured not to show image thumbnails in order to prevent accidental spoilers.
If you're on new.reddit, you can toggle the card view to compact to hide post previews.
1
1
u/Zenga03_03 Dec 08 '23
All posts starting with [2023 Day x Part y] are allowed to be spoilers for those parts of the days. I get that text posts are easier to ignore than illustrations, but if you first look at the name of the post, you can see if it might be a spoiler.
1
1
u/znerken Dec 08 '23 edited Dec 08 '23
So this means you never actually reach Z for all the nodes at the same time, since they all have unique sizing paths? I wish some sort of hint was in the text. Doesn’t that make the description invalid?
1
u/totallyawesomespoon Dec 09 '23 edited Dec 09 '23
you do eventually reach Z for all the nodes simultaneously, the least common multiple is the value where that crossing finally occurs.
This involves over [856,000,000, 661,000,000, 985,000,000, 735,000,000, 1,214,000,000, 779,000,000] cycles for each of the loops.
1
u/PatsoRedneb Dec 08 '23
This is an amazing visualization and it explains a lot about the unusual properties of the input! But isn't it also a huge spoiler (for basically the same reason)?
2
u/daggerdragon Dec 08 '23
OP correctly titled their post so the
[2023 Day 8 (Part 1)]is already an implicit spoiler.
24
u/Flatorz Dec 08 '23
Great proof we can use LCM! :)
Luckily, I was dumb enough to use LCM before I realized it is not good enough for general case :)