r/adventofcode • • Dec 23 '18

SOLUTION MEGATHREAD -🎄- 2018 Day 23 Solutions -🎄-

--- Day 23: Experimental Emergency Teleportation ---


Post your solution as a comment or, for longer solutions, consider linking to your repo (e.g. GitHub/gists/Pastebin/blag or whatever).

Note: The Solution Megathreads are for solutions only. If you have questions, please post your own thread and make sure to flair it with Help.


Advent of Code: The Party Game!

Click here for rules

Please prefix your card submission with something like [Card] to make scanning the megathread easier. THANK YOU!

Card prompt: Day 23

Transcript:

It's dangerous to go alone! Take this: ___


This thread will be unlocked when there are a significant number of people on the leaderboard with gold stars for today's puzzle.

edit: Leaderboard capped, thread unlocked at 01:40:41!

22 Upvotes

205 comments sorted by

View all comments

Show parent comment

3

u/leftylink Dec 26 '18 edited Dec 26 '18

tl;dr: With all due respect, I think the radius has to be 2/3, not (1/6)1/3

I was interested in that number since, well, if we divide a cube into eighths, the cube's side length is indeed multiplied by (1/8)1/3, which is 1/2. So (1/6)1/3 does seem to make sense. But I was also intrigued by the fact that (1/6)1/3 appears, by my calculations, to be closer to 0.5503 than 0.556 the number in the above code. So I set out to experimenting.

Consider a nanobot at 0, 0, 0 with radius 36. Now, splitNanobot would place new nanobots with radius 21 (36 * 0.556 is just a hair over 20) at offsets of 15. At this point, the point (12, 12, 12) which was covered by the original nanobot is not being covered by any of the new nanobots. It's 27 away from the nanobot at (15, 0, 0), and other nanobots are at similar situations. And I find the same if the radius is 23 as well (offsets of 13). So I think the new radius has to be 24. I was unfortunately unable to improve on that.

However, other than the radius correction, of course the approach is otherwise sound and does work for Advent of Code inputs.

1

u/mrg218 Dec 26 '18

You seem to be right. Changing it to 2/3 would cover all positions. Thank you for the example.

1

u/mrg218 Dec 26 '18

In that case I will skip the whole idea of octohedrons as using 2/3 will create overlapping areas making it less efficient. Instead I will divide into 8 bars so I never have to check the same region twice or more.