part1 (3751B)
1--- Day 18: Settlers of The North Pole --- 2 3On the outskirts of the North Pole base construction project, many Elves are collecting lumber. 4 5The lumber collection area is 50 acres by 50 acres; each acre can be either [1m[97mopen ground[0m (.), 6[1m[97mtrees[0m (|), or a [1m[97mlumberyard[0m (#). You take a scan of the area (your puzzle input). 7 8Strange magic is at work here: each minute, the landscape looks entirely different. In exactly 9[1m[97mone minute[0m, an open acre can fill with trees, a wooded acre can be converted to a lumberyard, or a 10lumberyard can be cleared to open ground (the lumber having been sent to other projects). 11 12The change to each acre is based entirely on [1m[97mthe contents of that acre[0m as well as [1m[97mthe number of 13open, wooded, or lumberyard acres adjacent to it[0m at the start of each minute. Here, "adjacent" means 14any of the eight acres surrounding that acre. (Acres on the edges of the lumber collection area 15might have fewer than eight adjacent acres; the missing acres aren't counted.) 16 17In particular: 18 19 20 - An [1m[97mopen[0m acre will become filled with [1m[97mtrees[0m if [1m[97mthree or more[0m adjacent acres contained trees. 21Otherwise, nothing happens. 22 23 - An acre filled with [1m[97mtrees[0m will become a [1m[97mlumberyard[0m if [1m[97mthree or more[0m adjacent acres were 24lumberyards. Otherwise, nothing happens. 25 26 - An acre containing a [1m[97mlumberyard[0m will remain a [1m[97mlumberyard[0m if it was adjacent to [1m[97mat least one other 27lumberyard and at least one acre containing trees[0m. Otherwise, it becomes [1m[97mopen[0m. 28 29 30These changes happen across all acres [1m[97msimultaneously[0m, each of them using the state of all acres at 31the beginning of the minute and changing to their new form by the end of that same minute. Changes 32that happen during the minute don't affect each other. 33 34For example, suppose the lumber collection area is instead only 10 by 10 acres with this initial 35configuration: 36 37Initial state: 38.#.#...|#. 39.....#|##| 40.|..|...#. 41..|#.....# 42#.#|||#|#| 43...#.||... 44.|....|... 45||...#|.#| 46|.||||..|. 47...#.|..|. 48 49After 1 minute: 50.......##. 51......|### 52.|..|...#. 53..|#||...# 54..##||.|#| 55...#||||.. 56||...|||.. 57|||||.||.| 58|||||||||| 59....||..|. 60 61After 2 minutes: 62.......#.. 63......|#.. 64.|.|||.... 65..##|||..# 66..###|||#| 67...#|||||. 68|||||||||. 69|||||||||| 70|||||||||| 71.||||||||| 72 73After 3 minutes: 74.......#.. 75....|||#.. 76.|.||||... 77..###|||.# 78...##|||#| 79.||##||||| 80|||||||||| 81|||||||||| 82|||||||||| 83|||||||||| 84 85After 4 minutes: 86.....|.#.. 87...||||#.. 88.|.#||||.. 89..###||||# 90...###||#| 91|||##||||| 92|||||||||| 93|||||||||| 94|||||||||| 95|||||||||| 96 97After 5 minutes: 98....|||#.. 99...||||#.. 100.|.##||||. 101..####|||# 102.|.###||#| 103|||###|||| 104|||||||||| 105|||||||||| 106|||||||||| 107|||||||||| 108 109After 6 minutes: 110...||||#.. 111...||||#.. 112.|.###|||. 113..#.##|||# 114|||#.##|#| 115|||###|||| 116||||#||||| 117|||||||||| 118|||||||||| 119|||||||||| 120 121After 7 minutes: 122...||||#.. 123..||#|##.. 124.|.####||. 125||#..##||# 126||##.##|#| 127|||####||| 128|||###|||| 129|||||||||| 130|||||||||| 131|||||||||| 132 133After 8 minutes: 134..||||##.. 135..|#####.. 136|||#####|. 137||#...##|# 138||##..###| 139||##.###|| 140|||####||| 141||||#||||| 142|||||||||| 143|||||||||| 144 145After 9 minutes: 146..||###... 147.||#####.. 148||##...##. 149||#....### 150|##....##| 151||##..###| 152||######|| 153|||###|||| 154|||||||||| 155|||||||||| 156 157After 10 minutes: 158.||##..... 159||###..... 160||##...... 161|##.....## 162|##.....## 163|##....##| 164||##.####| 165||#####||| 166||||#||||| 167|||||||||| 168 169After 10 minutes, there are 37 wooded acres and 31 lumberyards. Multiplying the number of wooded 170acres by the number of lumberyards gives the total [1m[97mresource value[0m after ten minutes: 37 * 31 = 171[1m[97m1147[0m. 172 173[1m[97mWhat will the total resource value of the lumber collection area be after 10 minutes?[0m 174 175