Fixed typo
[advent-of-code-15.git] / advent-of-code-19.html
1 <!DOCTYPE html>
2 <html lang="en-us">
3 <head>
4 <meta charset="utf-8"/>
5 <title>Day 19 - Advent of Code</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?3"/>
9 <link rel="shortcut icon" href="/favicon.ico?2"/>
10 </head><!--
11
12
13
14
15 Oh, hello! Funny seeing you here.
16
17 I appreciate your enthusiasm, but you aren't going to find much down here.
18 There certainly aren't clues to any of the puzzles. You do risk spoiling a few
19 surprises for yourself, though. Best to play the normal way and discover
20 everything as it was intended, I think. The best surprises don't even appear
21 in the source until you unlock them for real.
22
23 Please be careful with automated requests; I'm not Google, and I can only take
24 so much traffic. Please be considerate so that everyone gets to play.
25
26 If you're curious about how Advent of Code works, it's running on some custom
27 Perl code. Other than a few integrations (auth, analytics, ads, social media),
28 I built the whole thing myself, including the design, animations, prose, and
29 all of the puzzles.
30
31 The puzzles probably took the longest; the easiest ones were around 45 minutes
32 each, but the harder ones took 2-3 hours, some even longer than that. A lot of
33 effort went into building this thing - I hope you're enjoying playing it as
34 much as I enjoyed making it for you!
35
36 If you'd like to hang out, I'm @ericwastl on Twitter.
37
38 - Eric Wastl
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 -->
90 <body>
91 <header><h1><a href="/">Advent of Code</a></h1><div class="user">Neil Smith <span class="star-count">38*</span></div><nav><ul><li><a href="/about">[About]</a></li><li><a href="/stats">[Stats]</a></li><li><a href="/leaderboard">[Leaderboard]</a></li><li><a href="/settings">[Settings]</a></li><li><a href="/auth/logout">[Log out]</a></li></ul></nav></header>
92
93 <div id="ad">
94 <script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
95 <!-- Advent of Code Wide Skyscraper -->
96 <ins class="adsbygoogle"
97 style="display:inline-block;width:160px;height:600px"
98 data-ad-client="ca-pub-9420604735624631"
99 data-ad-slot="8014013294"></ins>
100 <script>
101 (adsbygoogle = window.adsbygoogle || []).push({});
102 </script>
103 </div><!--/ad-->
104
105 <main>
106 <article class="day-desc"><h2>--- Day 19: Medicine for Rudolph ---</h2><p>Rudolph the Red-Nosed Reindeer is sick! His nose isn't shining very brightly, and he needs medicine.</p>
107 <p>Red-Nosed Reindeer biology isn't similar to regular reindeer biology; Rudolph is going to need custom-made medicine. Unfortunately, Red-Nosed Reindeer chemistry isn't similar to regular reindeer chemistry, either.</p>
108 <p>The North Pole is equipped with a Red-Nosed Reindeer nuclear fusion/fission plant, capable of constructing any Red-Nosed Reindeer molecule you need. It works by starting with some input molecule and then doing a series of <em>replacements</em>, one per step, until it has the right molecule.</p>
109 <p>However, the machine has to be calibrated before it can be used. Calibration involves determining the number of molecules that can be generated in one step from a given starting point.</p>
110 <p>For example, imagine a simpler machine that supports only the following replacements:</p>
111 <pre><code>H => HO
112 H => OH
113 O => HH
114 </code></pre>
115 <p>Given the replacements above and starting with <code>HOH</code>, the following molecules could be generated:</p>
116 <ul>
117 <li><code>HOOH</code> (via <code>H => HO</code> on the first <code>H</code>).</li>
118 <li><code>HOHO</code> (via <code>H => HO</code> on the second <code>H</code>).</li>
119 <li><code>OHOH</code> (via <code>H => OH</code> on the first <code>H</code>).</li>
120 <li><code>HOOH</code> (via <code>H => OH</code> on the second <code>H</code>).</li>
121 <li><code>HHHH</code> (via <code>O => HH</code>).</li>
122 </ul>
123 <p>So, in the example above, there are <code>4</code> <em>distinct</em> molecules (not five, because <code>HOOH</code> appears twice) after one replacement from <code>HOH</code>. Santa's favorite molecule, <code>HOHOHO</code>, can become <code>7</code> <em>distinct</em> molecules (over nine replacements: six from <code>H</code>, and three from <code>O</code>).</p>
124 <p>The machine replaces without regard for the surrounding characters. For example, given the string <code>H2O</code>, the transition <code>H => OO</code> would result in <code>OO2O</code>.</p>
125 <p>Your puzzle input describes all of the possible replacements and, at the bottom, the medicine molecule for which you need to calibrate the machine. <em>How many distinct molecules can be created</em> after all the different ways you can do one replacement on the medicine molecule?</p>
126 </article>
127 <p>Your puzzle answer was <code>518</code>.</p><article class="day-desc"><h2>--- Part Two ---</h2><p>Now that the machine is calibrated, you're ready to begin molecule fabrication.</p>
128 <p>Molecule fabrication always begins with just a single <span title="It's a Red-Nosed Reindeer electron.">electron</span>, <code>e</code>, and applying replacements one at a time, just like the ones during calibration.</p>
129 <p>For example, suppose you have the following replacements:</p>
130 <pre><code>e => H
131 e => O
132 H => HO
133 H => OH
134 O => HH
135 </code></pre>
136 <p>If you'd like to make <code>HOH</code>, you start with <code>e</code>, and then make the following replacements:</p>
137 <ul>
138 <li><code>e => O</code> to get <code>O</code></li>
139 <li><code>O => HH</code> to get <code>HH</code></li>
140 <li><code>H => OH</code> (on the second <code>H</code>) to get <code>HOH</code></li>
141 </ul>
142 <p>So, you could make <code>HOH</code> after <em><code>3</code> steps</em>. Santa's favorite molecule, <code>HOHOHO</code>, can be made in <em><code>6</code> steps</em>.</p>
143 <p>How long will it take to make the medicine? Given the available <em>replacements</em> and the <em>medicine molecule</em> in your puzzle input, what is the <em>fewest number of steps</em> to go from <code>e</code> to the medicine molecule?</p>
144 </article>
145 <p>Your puzzle answer was <code>200</code>.</p><p class="day-success">Both parts of this puzzle are complete! They provide two gold stars: **</p>
146 <p>At this point, you should <a href="/">return to your advent calendar</a> and try another puzzle.</p>
147 <p>If you still want to see it, you can <a href="/day/19/input" target="_blank">get your puzzle input</a>.</p>
148 <p>You can also <span class="share">[Share<span class="share-content">on
149 <a href="https://twitter.com/intent/tweet?text=I%27ve+completed+%22Medicine+for+Rudolph%22+%2D+Day+19+%2D+Advent+of+Code&amp;url=http%3A%2F%2Fadventofcode%2Ecom%2Fday%2F19&amp;related=ericwastl&amp;hashtags=AdventOfCode" target="_blank">Twitter</a>
150 <a href="https://plus.google.com/share?url=http%3A%2F%2Fadventofcode%2Ecom%2Fday%2F19" target="_blank">Google+</a>
151 <a href="http://www.reddit.com/submit?url=http%3A%2F%2Fadventofcode%2Ecom%2Fday%2F19&amp;title=I%27ve+completed+%22Medicine+for+Rudolph%22+%2D+Day+19+%2D+Advent+of+Code" target="_blank">Reddit</a
152 ></span>]</span>
153 this puzzle.</p>
154 </main>
155
156 <!-- ga -->
157 <script>
158 (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
159 (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
160 m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
161 })(window,document,'script','//www.google-analytics.com/analytics.js','ga');
162 ga('create', 'UA-69522494-1', 'auto');
163 ga('send', 'pageview');
164 </script>
165 <!-- /ga -->
166 </body>
167 </html>