aboutsummaryrefslogtreecommitdiffstats
path: root/src/24/part2
diff options
context:
space:
mode:
authorLouis Burda <quent.burda@gmail.com>2023-04-07 17:18:18 -0400
committerLouis Burda <quent.burda@gmail.com>2023-04-07 17:19:39 -0400
commit87ab487d59fa85dbe2afa55cc841b02805ae42ca (patch)
treecd90ab715e1b5b5803674045dbafd6d51d27ac90 /src/24/part2
parent1bcc82c5bfbde87edd03c01ffdf9ee5934681592 (diff)
downloadaoc2018-python-87ab487d59fa85dbe2afa55cc841b02805ae42ca.tar.gz
aoc2018-python-87ab487d59fa85dbe2afa55cc841b02805ae42ca.zip
Reorder days into src
Diffstat (limited to 'src/24/part2')
-rw-r--r--src/24/part2186
1 files changed, 186 insertions, 0 deletions
diff --git a/src/24/part2 b/src/24/part2
new file mode 100644
index 0000000..2cf3f09
--- /dev/null
+++ b/src/24/part2
@@ -0,0 +1,186 @@
+--- Part Two ---
+
+After careful analysis, one thing is certain: you have no idea where all these bugs are coming
+from.
+
+Then, you remember: Eris is an old Plutonian settlement! Clearly, the bugs are coming from
+recursively-folded space.
+
+This 5x5 grid is only one level in an infinite number of recursion levels. The tile in the middle of
+the grid is actually another 5x5 grid, the grid in your scan is contained as the middle tile of a
+larger 5x5 grid, and so on. Two levels of grids look like this:
+
+ | | | |
+ | | | |
+ | | | |
+-----+-----+---------+-----+-----
+ | | | |
+ | | | |
+ | | | |
+-----+-----+---------+-----+-----
+ | | | | | | | |
+ | |-+-+-+-+-| |
+ | | | | | | | |
+ | |-+-+-+-+-| |
+ | | | |?| | | |
+ | |-+-+-+-+-| |
+ | | | | | | | |
+ | |-+-+-+-+-| |
+ | | | | | | | |
+-----+-----+---------+-----+-----
+ | | | |
+ | | | |
+ | | | |
+-----+-----+---------+-----+-----
+ | | | |
+ | | | |
+ | | | |
+
+(To save space, some of the tiles are not drawn to scale.) Remember, this is only a small part of
+the infinitely recursive grid; there is a 5x5 grid that contains this diagram, and a 5x5 grid that
+contains that one, and so on. Also, the ? in the diagram contains another 5x5 grid, which itself
+contains another 5x5 grid, and so on.
+
+The scan you took (your puzzle input) shows where the bugs are on a single level of this structure.
+The middle tile of your scan is empty to accommodate the recursive grids within it. Initially, no
+other levels contain bugs.
+
+Tiles still count as adjacent if they are directly up, down, left, or right of a given tile. Some
+tiles have adjacent tiles at a recursion level above or below its own level. For example:
+
+ | | | |
+ 1 | 2 | 3 | 4 | 5
+ | | | |
+-----+-----+---------+-----+-----
+ | | | |
+ 6 | 7 | 8 | 9 | 10
+ | | | |
+-----+-----+---------+-----+-----
+ | |A|B|C|D|E| |
+ | |-+-+-+-+-| |
+ | |F|G|H|I|J| |
+ | |-+-+-+-+-| |
+ 11 | 12 |K|L|?|N|O| 14 | 15
+ | |-+-+-+-+-| |
+ | |P|Q|R|S|T| |
+ | |-+-+-+-+-| |
+ | |U|V|W|X|Y| |
+-----+-----+---------+-----+-----
+ | | | |
+ 16 | 17 | 18 | 19 | 20
+ | | | |
+-----+-----+---------+-----+-----
+ | | | |
+ 21 | 22 | 23 | 24 | 25
+ | | | |
+
+
+ - Tile 19 has four adjacent tiles: 14, 18, 20, and 24.
+
+ - Tile G has four adjacent tiles: B, F, H, and L.
+
+ - Tile D has four adjacent tiles: 8, C, E, and I.
+
+ - Tile E has four adjacent tiles: 8, D, 14, and J.
+
+ - Tile 14 has eight adjacent tiles: 9, E, J, O, T, Y, 15, and 19.
+
+ - Tile N has eight adjacent tiles: I, O, S, and five tiles within the sub-grid marked ?.
+
+
+The rules about bugs living and dying are the same as before.
+
+For example, consider the same initial state as above:
+
+....#
+#..#.
+#.?##
+..#..
+#....
+
+The center tile is drawn as ? to indicate the next recursive grid. Call this level 0; the grid
+within this one is level 1, and the grid that contains this one is level -1. Then, after
+ten minutes, the grid at each level would look like this:
+
+Depth -5:
+..#..
+.#.#.
+..?.#
+.#.#.
+..#..
+
+Depth -4:
+...#.
+...##
+..?..
+...##
+...#.
+
+Depth -3:
+#.#..
+.#...
+..?..
+.#...
+#.#..
+
+Depth -2:
+.#.##
+....#
+..?.#
+...##
+.###.
+
+Depth -1:
+#..##
+...##
+..?..
+...#.
+.####
+
+Depth 0:
+.#...
+.#.##
+.#?..
+.....
+.....
+
+Depth 1:
+.##..
+#..##
+..?.#
+##.##
+#####
+
+Depth 2:
+###..
+##.#.
+#.?..
+.#.##
+#.#..
+
+Depth 3:
+..###
+.....
+#.?..
+#....
+#...#
+
+Depth 4:
+.###.
+#..#.
+#.?..
+##.#.
+.....
+
+Depth 5:
+####.
+#..#.
+#.?#.
+####.
+.....
+
+In this example, after 10 minutes, a total of 99 bugs are present.
+
+Starting with your scan, how many bugs are present after 200 minutes?
+
+