I agree part 2 was annoying. I misread the problem description where it said that *most* robots would form an image and looked for a state where *all* robots were connected in one big Christmas tree, DOH! What worked for me was looping until no robots overlapped, and at least one robot had eight neighbors.
Here is how I did part 2: I figured that Christmas Tree should have several long horizontal lines of robots, and there should be a high degree of symmetry. So I calculated a "Symmetry Score" for each time second that measured the degree of horizontal symmetry and looked for when that symmetry score spiked up.
Yeah this method is cool, me being thick as brick i had to create 10,000 images and then painfully going through thumbnails in the finders locate the solution lol!
Note to other viewers, my input tree is located almost in the middle of the image. This makes the safety scores not much larger/smaller than other false images. Seems like better heuristics might be necessary for cases like this. Removing "Robots that are exactly in the middle (horizontally or vertically) don't count as being in any quadrant" condition from the safety score calculation didn't help.
Cool way to solve part 2!
I just printed the first 10,000 iterations and scrolled through in VSCode while keeping an eye on the mini-map.
I agree part 2 was annoying. I misread the problem description where it said that *most* robots would form an image and looked for a state where *all* robots were connected in one big Christmas tree, DOH!
What worked for me was looping until no robots overlapped, and at least one robot had eight neighbors.
Yeah. Seems like a bad problem
Here is how I did part 2:
I figured that Christmas Tree should have several long horizontal lines of robots, and there should be a high degree of symmetry. So I calculated a "Symmetry Score" for each time second that measured the degree of horizontal symmetry and looked for when that symmetry score spiked up.
Ah smart. It's an interesting challenge, though I still don't like not knowing if my solution also solves other inputs.
Yeah this method is cool, me being thick as brick i had to create 10,000 images and then painfully going through thumbnails in the finders locate the solution lol!
Note to other viewers, my input tree is located almost in the middle of the image. This makes the safety scores not much larger/smaller than other false images. Seems like better heuristics might be necessary for cases like this. Removing "Robots that are exactly in the middle (horizontally or vertically) don't count as being in any quadrant" condition from the safety score calculation didn't help.
That sounds painful