Done day 23
[advent-of-code-18.git] / problems / day23.html
1 <!DOCTYPE html>
2 <html lang="en-us">
3 <head>
4 <meta charset="utf-8"/>
5 <title>Day 23 - Advent of Code 2018</title>
6 <!--[if lt IE 9]><script src="/static/html5.js"></script><![endif]-->
7 <link href='//fonts.googleapis.com/css?family=Source+Code+Pro:300&subset=latin,latin-ext' rel='stylesheet' type='text/css'>
8 <link rel="stylesheet" type="text/css" href="/static/style.css?20"/>
9 <link rel="stylesheet alternate" type="text/css" href="/static/highcontrast.css?0" title="High Contrast"/>
10 <link rel="shortcut icon" href="/favicon.png"/>
11 </head><!--
12
13
14
15
16 Oh, hello! Funny seeing you here.
17
18 I appreciate your enthusiasm, but you aren't going to find much down here.
19 There certainly aren't clues to any of the puzzles. The best surprises don't
20 even appear in the source until you unlock them for real.
21
22 Please be careful with automated requests; I'm not Google, and I can only take
23 so much traffic. Please be considerate so that everyone gets to play.
24
25 If you're curious about how Advent of Code works, it's running on some custom
26 Perl code. Other than a few integrations (auth, analytics, ads, social media),
27 I built the whole thing myself, including the design, animations, prose, and
28 all of the puzzles.
29
30 The puzzles are most of the work; the easiest ones take 3-4 hours each, but the
31 harder ones take 6-8 hours, and a few even longer than that. A lot of effort
32 went into building this thing - I hope you're enjoying playing it as much as I
33 enjoyed making it for you!
34
35 If you'd like to hang out, I'm @ericwastl on Twitter.
36
37 - Eric Wastl
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88 -->
89 <body>
90 <header><div><h1 class="title-global"><a href="/">Advent of Code</a></h1><nav><ul><li><a href="/2018/about">[About]</a></li><li><a href="/2018/events">[Events]</a></li><li><a href="https://teespring.com/adventofcode-2019" target="_blank">[Shop]</a></li><li><a href="/2018/settings">[Settings]</a></li><li><a href="/2018/auth/logout">[Log Out]</a></li></ul></nav><div class="user">Neil Smith <a href="/2018/support" class="supporter-badge" title="Advent of Code Supporter">(AoC++)</a> <span class="star-count">46*</span></div></div><div><h1 class="title-event">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="title-event-wrap">/^</span><a href="/2018">2018</a><span class="title-event-wrap">$/</span></h1><nav><ul><li><a href="/2018">[Calendar]</a></li><li><a href="/2018/support">[AoC++]</a></li><li><a href="/2018/sponsors">[Sponsors]</a></li><li><a href="/2018/leaderboard">[Leaderboard]</a></li><li><a href="/2018/stats">[Stats]</a></li></ul></nav></div></header>
91
92 <div id="sidebar">
93 <div id="sponsor"><div class="quiet">Our <a href="/2018/sponsors">sponsors</a> help make Advent of Code possible:</div><div class="sponsor"><a href="https://smartystreets.com/aoc" target="_blank" onclick="if(ga)ga('send','event','sponsor','click',this.href);" rel="noopener">SmartyStreets</a> - Global address validation made by developers, for developers</div></div>
94 </div><!--/sidebar-->
95
96 <main>
97 <article class="day-desc"><h2>--- Day 23: Experimental Emergency Teleportation ---</h2><p>Using your torch to search the darkness of the rocky cavern, you finally locate the man's friend: a small <em>reindeer</em>.</p>
98 <p>You're not sure how it got so far in this cave. It looks sick - too sick to walk - and too heavy for you to carry all the way back. Sleighs won't be invented for another 1500 years, of course.</p>
99 <p>The only option is <em>experimental emergency teleportation</em>.</p>
100 <p>You hit the "experimental emergency teleportation" <span title="We've always had this button; we've just been too scared to press it.">button</span> on the device and push <em>I accept the risk</em> on no fewer than 18 different warning messages. Immediately, the device deploys hundreds of tiny <em>nanobots</em> which fly around the cavern, apparently assembling themselves into a very specific <em>formation</em>. The device lists the <code>X,Y,Z</code> position (<code>pos</code>) for each nanobot as well as its <em>signal radius</em> (<code>r</code>) on its tiny screen (your puzzle input).</p>
101 <p>Each nanobot can transmit signals to any integer coordinate which is a distance away from it <em>less than or equal to</em> its signal radius (as measured by <a href="https://en.wikipedia.org/wiki/Taxicab_geometry">Manhattan distance</a>). Coordinates a distance away of less than or equal to a nanobot's signal radius are said to be <em>in range</em> of that nanobot.</p>
102 <p>Before you start the teleportation process, you should determine which nanobot is the <em>strongest</em> (that is, which has the largest signal radius) and then, for that nanobot, the <em>total number of nanobots that are in range</em> of it, <em>including itself</em>.</p>
103 <p>For example, given the following nanobots:</p>
104 <pre><code>pos=&lt;0,0,0&gt;, r=4
105 pos=&lt;1,0,0&gt;, r=1
106 pos=&lt;4,0,0&gt;, r=3
107 pos=&lt;0,2,0&gt;, r=1
108 pos=&lt;0,5,0&gt;, r=3
109 pos=&lt;0,0,3&gt;, r=1
110 pos=&lt;1,1,1&gt;, r=1
111 pos=&lt;1,1,2&gt;, r=1
112 pos=&lt;1,3,1&gt;, r=1
113 </code></pre>
114 <p>The strongest nanobot is the first one (position <code>0,0,0</code>) because its signal radius, <code>4</code> is the largest. Using that nanobot's location and signal radius, the following nanobots are in or out of range:</p>
115 <ul>
116 <li>The nanobot at <code>0,0,0</code> is distance <code>0</code> away, and so it is <em>in range</em>.</li>
117 <li>The nanobot at <code>1,0,0</code> is distance <code>1</code> away, and so it is <em>in range</em>.</li>
118 <li>The nanobot at <code>4,0,0</code> is distance <code>4</code> away, and so it is <em>in range</em>.</li>
119 <li>The nanobot at <code>0,2,0</code> is distance <code>2</code> away, and so it is <em>in range</em>.</li>
120 <li>The nanobot at <code>0,5,0</code> is distance <code>5</code> away, and so it is <em>not</em> in range.</li>
121 <li>The nanobot at <code>0,0,3</code> is distance <code>3</code> away, and so it is <em>in range</em>.</li>
122 <li>The nanobot at <code>1,1,1</code> is distance <code>3</code> away, and so it is <em>in range</em>.</li>
123 <li>The nanobot at <code>1,1,2</code> is distance <code>4</code> away, and so it is <em>in range</em>.</li>
124 <li>The nanobot at <code>1,3,1</code> is distance <code>5</code> away, and so it is <em>not</em> in range.</li>
125 </ul>
126 <p>In this example, in total, <code><em>7</em></code> nanobots are in range of the nanobot with the largest signal radius.</p>
127 <p>Find the nanobot with the largest signal radius. <em>How many nanobots are in range</em> of its signals?</p>
128 </article>
129 <p>Your puzzle answer was <code>510</code>.</p><article class="day-desc"><h2 id="part2">--- Part Two ---</h2><p>Now, you just need to figure out where to position yourself so that you're actually teleported when the nanobots activate.</p>
130 <p>To increase the probability of success, you need to find the coordinate which puts you <em>in range of the largest number of nanobots</em>. If there are multiple, choose one <em>closest to your position</em> (<code>0,0,0</code>, measured by manhattan distance).</p>
131 <p>For example, given the following nanobot formation:</p>
132 <pre><code>pos=&lt;10,12,12&gt;, r=2
133 pos=&lt;12,14,12&gt;, r=2
134 pos=&lt;16,12,12&gt;, r=4
135 pos=&lt;14,14,14&gt;, r=6
136 pos=&lt;50,50,50&gt;, r=200
137 pos=&lt;10,10,10&gt;, r=5
138 </code></pre>
139 <p>Many coordinates are in range of some of the nanobots in this formation. However, only the coordinate <code>12,12,12</code> is in range of the most nanobots: it is in range of the first five, but is not in range of the nanobot at <code>10,10,10</code>. (All other coordinates are in range of fewer than five nanobots.) This coordinate's distance from <code>0,0,0</code> is <code><em>36</em></code>.</p>
140 <p>Find the coordinates that are in range of the largest number of nanobots. <em>What is the shortest manhattan distance between any of those points and <code>0,0,0</code>?</em></p>
141 </article>
142 <p>Your puzzle answer was <code>108889300</code>.</p><p class="day-success">Both parts of this puzzle are complete! They provide two gold stars: **</p>
143 <p>At this point, you should <a href="/2018">return to your Advent calendar</a> and try another puzzle.</p>
144 <p>If you still want to see it, you can <a href="23/input" target="_blank">get your puzzle input</a>.</p>
145 <p>You can also <span class="share">[Share<span class="share-content">on
146 <a href="https://twitter.com/intent/tweet?text=I%27ve+completed+%22Experimental+Emergency+Teleportation%22+%2D+Day+23+%2D+Advent+of+Code+2018&amp;url=https%3A%2F%2Fadventofcode%2Ecom%2F2018%2Fday%2F23&amp;related=ericwastl&amp;hashtags=AdventOfCode" target="_blank">Twitter</a>
147 <a href="http://www.reddit.com/submit?url=https%3A%2F%2Fadventofcode%2Ecom%2F2018%2Fday%2F23&amp;title=I%27ve+completed+%22Experimental+Emergency+Teleportation%22+%2D+Day+23+%2D+Advent+of+Code+2018" target="_blank">Reddit</a
148 ></span>]</span> this puzzle.</p>
149 </main>
150
151 <!-- ga -->
152 <script>
153 (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
154 (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
155 m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
156 })(window,document,'script','//www.google-analytics.com/analytics.js','ga');
157 ga('create', 'UA-69522494-1', 'auto');
158 ga('set', 'anonymizeIp', true);
159 ga('send', 'pageview');
160 </script>
161 <!-- /ga -->
162 </body>
163 </html>