r/adventofcode • u/EffectivePriority986 • Dec 20 '23
Visualization [2023 day 20] Visualization of the input - couldn't solve part 2 without it
83
Upvotes
r/adventofcode • u/EffectivePriority986 • Dec 20 '23
13
u/Sostratus Dec 20 '23
Thanks. I was just looking at text of my input manually and only noticed 3 of the cyclers, seeing you had 4 made me check again, I just missed it.
This problem was weird to me in that it seems unsolvable from the problem statement alone. Am I wrong? Obviously input files are immensely helpful when debugging, but usually the problem description and the provided examples would be sufficient to write a solution if you were careful. In this case, I ended up with a lot of hard coded junk in my script which fed me raw data that I analyzed in a spreadsheet.
4
u/soulofcure Dec 20 '23
What did you use to make the visualization?
4
u/Empty_Barracuda_1125 Dec 20 '23
Thanks for the hint! I really didn't expect to have to learn visualization to solve an advent of code puzzle but your post tipped me off so I learned how to use PyVis and then finally solved the puzzle :)
2
u/pwnsforyou Dec 20 '23
The cycle length of each input can be easily derived from just the picture - go from the top most flip flop that leads to the nand and take 0 if the flip flop output doesn't lead to nand , 1 if it does (from lsb to msb). Thats how I solved it.
2
u/muckenhoupt Dec 20 '23
I didn't draw a graph, but I did try to rearrange the text file and indent it nicely, and wound up with structures that convey similar info. Wound up solving part 2 by hand while my computer was still chugging away at the brute force solution.
2
u/WindyMiller2006 Dec 20 '23
Thanks, I was completely stuck on what to do for part 2 until I saw this. If you use https://dreampuf.github.io and set the engine to "fdp", you get a much clearer idea of what is going on too. Here's mine...
https://pasteboard.co/LBAfXP3RRKbb.png
2
u/ranikola Dec 20 '23
I also used GraphViz, built a small JS utility to generate input, details in this post. When shapes are used it draws much nicer visualisation.
1
u/DecisiveVictory Dec 20 '23
How did you build this? What's the easiest way to do it programatically?
1
u/choroba Dec 20 '23 edited Dec 20 '23
I wrote a short Perl script to visualise the input:
The output is almost identical (except for some shape and colour changes).
https://imgur.com/a/RGOtbIP
1
u/Spare_Chest9755 Dec 20 '23
thx
I don't think I could have figured it out on my own.
With the experience of previous days and your graph, that's fine :)
But in fact you just have to look to the target module(rx), and take a look at the few previous of this one.
Let's be quite until 6 A.M tomorrow now !
1
u/CAG2Reddit Dec 20 '23
I also did the exact same thing! This is what helped me solve it :)
Each machine is actually a modified 12-bit binary counter that cycles every <insert 12 bit number> passes