Decided to forgo my usual visualization (which is mainly targeted at 2D) and use matplotlib for this one.
Here's a visualization of the "circuits" with each circuit color coded. Whenever one circuit gets connected to another, the smaller circuit adopts the color of the larger circuit.
In an earlier version of this, I just rendered a frame for every n connections made. That got relatively boring towards the end, however, as most connections were just connecting two points already on the same giant circuit and it was just a matter of waiting for the last point to finally get connected to it. The version shown here instead renders frames based on whenever n circuits have merged, hence a whole bunch of edges all of a sudden at the end.
Minimum spanning trees were my first thought as well - however I don't know how to think about coding one in a 3 dimensional space...I've only ever done so on a 2d plain. How do you measure the edges in 3d space?
Beautiful! Am I going crazy, or does it seem to add a ton of connections at the end? I'm looking at nodes on the edges, and they seem to jump from having one or two to like 5.
It does! I first tried with adding a set number of connections per frame, but most of the time in the later half was just spent adding more connections between the one main set without connecting new sets together. (If you've got two sets, of 999 nodes and 1 node each, it can take a while before a connection is made to the 1.) So here, the animation time is relative to the sets connecting instead. It basically fast-forwards through to where it finally connects the last few remaining sets to the big one.
Think of this as showing a constant rate of sets merging, rather than a constant rate of nodes connecting.
The sample answer I got for part 1 considering all the 20 conductors was 45 and if I considered only the first 10 connections it gives me 40 though. I got the correct answer considering 1000 conductors. Anyways this visualization is great.
12
u/Boojum Dec 08 '25
Decided to forgo my usual visualization (which is mainly targeted at 2D) and use matplotlib for this one.
Here's a visualization of the "circuits" with each circuit color coded. Whenever one circuit gets connected to another, the smaller circuit adopts the color of the larger circuit.
In an earlier version of this, I just rendered a frame for every n connections made. That got relatively boring towards the end, however, as most connections were just connecting two points already on the same giant circuit and it was just a matter of waiting for the last point to finally get connected to it. The version shown here instead renders frames based on whenever n circuits have merged, hence a whole bunch of edges all of a sudden at the end.
Source
41
u/KyxeMusic Dec 08 '25
this made me realize how darn complicated these Elves have set up their boxes lol
4
u/vagrantchord Dec 08 '25
Beautiful! Am I going crazy, or does it seem to add a ton of connections at the end? I'm looking at nodes on the edges, and they seem to jump from having one or two to like 5.
2
u/Jolly_Tailor3252 Dec 08 '25
How do you guys interpret this condition?
"After making the ten shortest connections"
For example, this case from the task description
"The next two junction boxes are
431,825,988and425,690,689. Because these two junction boxes were already in the same circuit, nothing happens!"count as a connection or not?
2
u/Trick_Fondant2534 Dec 08 '25
I love the vidualization, what tool did u use it to create it like this
65
u/bobosherm Dec 08 '25
My solution vs solution of the guy she told me not to worry about
4
u/edo360 Dec 08 '25
Beautiful ! ✨⊹ ࣪ ˖˚ ༘ ೀ⋆。˚🔆
I have been watching it full screen during minutes.
I clearly got hypnotized by the Elves' fairy lights...
3
u/wubrgess Dec 08 '25
Why aren't all the zeroes together?
3
u/FruitdealerF Dec 08 '25
Slightly disoriented it's not in the shape of a Christmas tree
2
u/Repulsive-Variety-57 Dec 08 '25
The sample answer I got for part 1 considering all the 20 conductors was 45 and if I considered only the first 10 connections it gives me 40 though. I got the correct answer considering 1000 conductors. Anyways this visualization is great.
2
u/d1meji Dec 09 '25
Very very cool!
1
u/Clear-Ad-9312 Dec 10 '25
I am still trying to solve part 1 lol