4 <meta charset=
"utf-8"/>
5 <title>Day
18 - 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?19"/>
9 <link rel=
"stylesheet alternate" type=
"text/css" href=
"/static/highcontrast.css?0" title=
"High Contrast"/>
10 <link rel=
"shortcut icon" href=
"/favicon.png"/>
16 Oh, hello! Funny seeing you here.
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.
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.
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
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!
35 If you'd like to hang out, I'm @ericwastl on Twitter.
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" 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">37*
</span></div></div><div><h1 class=
"title-event"> <span class=
"title-event-wrap">0x0000|
</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>
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://www.honeypot.io/" target=
"_blank" onclick=
"if(ga)ga('send','event','sponsor','click',this.href);" rel=
"noopener">Honeypot.io
</a> - Europe's Tech Job Platform where companies apply to you with salary and tech stack upfront!
</div></div>
97 <article class=
"day-desc"><h2>--- Day
18: Settlers of The North Pole ---
</h2><p>On the outskirts of the North Pole base construction project, many Elves are collecting
<span title=
"Trade wood for sheep?">lumber
</span>.
</p>
98 <p>The lumber collection area is
50 acres by
50 acres; each acre can be either
<em>open ground
</em> (
<code>.
</code>),
<em>trees
</em> (
<code>|
</code>), or a
<em>lumberyard
</em> (
<code>#
</code>). You take a scan of the area (your puzzle input).
</p>
99 <p>Strange magic is at work here: each minute, the landscape looks entirely different. In exactly
<em>one minute
</em>, an open acre can fill with trees, a wooded acre can be converted to a lumberyard, or a lumberyard can be cleared to open ground (the lumber having been sent to other projects).
</p>
100 <p>The change to each acre is based entirely on
<em>the contents of that acre
</em> as well as
<em>the number of open, wooded, or lumberyard acres adjacent to it
</em> at the start of each minute. Here,
"adjacent" means any of the eight acres surrounding that acre. (Acres on the edges of the lumber collection area might have fewer than eight adjacent acres; the missing acres aren't counted.)
</p>
101 <p>In particular:
</p>
103 <li>An
<em>open
</em> acre will become filled with
<em>trees
</em> if
<em>three or more
</em> adjacent acres contained trees. Otherwise, nothing happens.
</li>
104 <li>An acre filled with
<em>trees
</em> will become a
<em>lumberyard
</em> if
<em>three or more
</em> adjacent acres were lumberyards. Otherwise, nothing happens.
</li>
105 <li>An acre containing a
<em>lumberyard
</em> will remain a
<em>lumberyard
</em> if it was adjacent to
<em>at least one other lumberyard and at least one acre containing trees
</em>. Otherwise, it becomes
<em>open
</em>.
</li>
107 <p>These changes happen across all acres
<em>simultaneously
</em>, each of them using the state of all acres at the beginning of the minute and changing to their new form by the end of that same minute. Changes that happen during the minute don't affect each other.
</p>
108 <p>For example, suppose the lumber collection area is instead only
10 by
10 acres with this initial configuration:
</p>
109 <pre><code>Initial state:
241 <p>After
10 minutes, there are
<code>37</code> wooded acres and
<code>31</code> lumberyards. Multiplying the number of wooded acres by the number of lumberyards gives the total
<em>resource value
</em> after ten minutes:
<code>37 *
31 =
<em>1147</em></code>.
</p>
242 <p><em>What will the total resource value of the lumber collection area be after
10 minutes?
</em></p>
244 <p>Your puzzle answer was
<code>384480</code>.
</p><article class=
"day-desc"><h2 id=
"part2">--- Part Two ---
</h2><p>This important natural resource will need to last for at least thousands of years. Are the Elves collecting this lumber sustainably?
</p>
245 <p><em>What will the total resource value of the lumber collection area be after
1000000000 minutes?
</em></p>
247 <p>Your puzzle answer was
<code>177004</code>.
</p><p class=
"day-success">Both parts of this puzzle are complete! They provide two gold stars: **
</p>
248 <p>At this point, you should
<a href=
"/2018">return to your advent calendar
</a> and try another puzzle.
</p>
249 <p>If you still want to see it, you can
<a href=
"18/input" target=
"_blank">get your puzzle input
</a>.
</p>
250 <p>You can also
<span class=
"share">[Share
<span class=
"share-content">on
251 <a href=
"https://twitter.com/intent/tweet?text=I%27ve+completed+%22Settlers+of+The+North+Pole%22+%2D+Day+18+%2D+Advent+of+Code+2018&url=https%3A%2F%2Fadventofcode%2Ecom%2F2018%2Fday%2F18&related=ericwastl&hashtags=AdventOfCode" target=
"_blank">Twitter
</a>
252 <a href=
"http://www.reddit.com/submit?url=https%3A%2F%2Fadventofcode%2Ecom%2F2018%2Fday%2F18&title=I%27ve+completed+%22Settlers+of+The+North+Pole%22+%2D+Day+18+%2D+Advent+of+Code+2018" target=
"_blank">Reddit
</a
253 ></span>]
</span> this puzzle.
</p>
258 (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
259 (i[r].q=i[r].q||[]).push(arguments)},i[r].l=
1*new Date();a=s.createElement(o),
260 m=s.getElementsByTagName(o)[
0];a.async=
1;a.src=g;m.parentNode.insertBefore(a,m)
261 })(window,document,'script','//www.google-analytics.com/analytics.js','ga');
262 ga('create', 'UA-
69522494-
1', 'auto');
263 ga('send', 'pageview');