From 44148fd4ae3c7a7433f95a8d14709f2351d764f5 Mon Sep 17 00:00:00 2001 From: Stefan Harmuth Date: Mon, 20 Dec 2021 08:14:34 +0100 Subject: [PATCH] day20 --- day20.py | 52 ++++++++++++++++++++ inputs/input20 | 102 ++++++++++++++++++++++++++++++++++++++++ inputs/test_input20_1_0 | 7 +++ inputs/test_input20_1_1 | 102 ++++++++++++++++++++++++++++++++++++++++ inputs/test_input20_2_0 | 7 +++ inputs/test_input20_2_1 | 102 ++++++++++++++++++++++++++++++++++++++++ notes | 3 ++ 7 files changed, 375 insertions(+) create mode 100644 day20.py create mode 100644 inputs/input20 create mode 100644 inputs/test_input20_1_0 create mode 100644 inputs/test_input20_1_1 create mode 100644 inputs/test_input20_2_0 create mode 100644 inputs/test_input20_2_1 create mode 100644 notes diff --git a/day20.py b/day20.py new file mode 100644 index 0000000..2096cd7 --- /dev/null +++ b/day20.py @@ -0,0 +1,52 @@ +from tools.aoc import AOCDay +from tools.coordinate import Coordinate +from tools.grid import Grid +from typing import Any, List + + +def enhance(image: Grid, enhancements: List[bool], count: int) -> Grid: + flippingInfinity = enhancements[0] and not enhancements[-1] + infinity = False + + for _ in range(count): + if flippingInfinity: + infinity = not infinity + + new_image = Grid(infinity) + for x in image.rangeX(pad=1): + for y in image.rangeY(pad=1): + index_str = '' + for y1 in [y - 1, y, y + 1]: + for x1 in [x - 1, x, x + 1]: + index_str += '1' if image.get(Coordinate(x1, y1)) else '0' + + new_image.set(Coordinate(x, y), enhancements[int(index_str, 2)]) + + image = new_image + + return image + + +class Day(AOCDay): + test_solutions_p1 = [35, 5425] + test_solutions_p2 = [3351, 14052] + + def getInputs(self) -> (Grid, List[bool]): + enhancement, image = self.getMultiLineInputAsArray() + enhancement = [c == '#' for c in enhancement[0]] + grid = Grid() + for y, l in enumerate(image): + for x, c in enumerate(l): + grid.set(Coordinate(x, y), c == '#') + + return grid, enhancement + + def part1(self) -> Any: + image, enhancement = self.getInputs() + image = enhance(image, enhancement, 2) + return image.getSum() + + def part2(self) -> Any: + image, enhancement = self.getInputs() + image = enhance(image, enhancement, 50) + return image.getSum() diff --git a/inputs/input20 b/inputs/input20 new file mode 100644 index 0000000..23527b3 --- /dev/null +++ b/inputs/input20 @@ -0,0 +1,102 @@ +###.#.##.##....##...##.#..##...#..##.#.#.#.##.##...#.##.#...#.#.#.#.#...##.#...#####..#...#.#.#...##.#.####.##.##.###......###.#.###...#..##.#..#..##.##.#..###.###.#.#...#.##.######..####..##..#.#.#####.##.###..###.#.#.#....##.#.####.....#..#..#.##.#.##...##.#...###......###.#....#..#......#.##.#..##.#.###.###.####.##..###.#...#.##.####.#.##..#.#..#.#.......#.####..#..##..###.####..##.#.##.###....#.###..####..##......###.##.#.#...#..####.##.#...#..###..##..####.###...#.#..##.#.###.#.....##..#...###..####... + +##..###.#.###..##.##..####.#..#.#.###..#.#.#....#.#.###...#.....#.##.##..#.####.##.#.####.#.#.....## +...#.#.###...###..##...#####..##..#..#.#..#.#...#.#..###...#..##.##....#.....#...########.######.##. +#...#.#.####....#....###..#.#.###.#.....####....###.#.###.#..###.###....##.##..#.##...##....##.##... +###..###.#..#######.....#..##.###..#####...##.###..#....##.##....####...#..###..###.#...##...###.### +#######.#........#####.##..##..#...#######..#.##...#.###...###...######...#####..#.#.#..#..#.#.#.#.. +..##.#.##.##.#...#.#.#........##.##.###..###.##.#.#.#.#..##.#.###..######..#.....#..#.###..#....#.#. +.#.....##.#...#.###...#.##..#.##.##.#.#.#####...###.#.##.###..#.#.#..#..##########.#.#####.##.#..##. +.#.#.##..#.#.####..#...#.#..##.########.#.###.#.#......##..########.####.##...###....###......#.#.## +##.#.#.#######..#....###...##.#.#.#..#.#.###.###..#....#..###....#.....##.####.##..##..##..#.###.... +.##..#######.######....#.#..#.......#.#.####.#.####.....#.####..##.#..##..##..#......#...###...#..#. +###.#..###..##..#.##...###.####...##........#..##.#.#.#.##...####...##..#..#.####......##..#..##.##. +#.#.##...#.##......#.......###.......##...#...#####.#.#..##..#..#####.###.######..###.###......##.## +#.#####.#.#..#...#.#..###.###.....###.##...#.##.##.###..#...##..##...#####...#.....##.#..####.#.###. +..######..###.#.#...#.#.##......###......#.#######..#.#....#.##....#..#.#.##....###.##.#.#...#...##. +##.##..#.##.##.#.#####.#####.##.#.##.#...##..##....##....###....##.###..##.###.#.#...##....##.#.##.# +.#.##.#.#.#.##...#.#.###.#...#.#....####.##.#..#####.#.#..######.##..#.#.#####....###..##..#.#...... +..###.....#.###.......#...#...##.#...##.##..##.##..##...###.#..#...##..#.#.#.##...#.#..#####.##..#.# +.##..#...#.##.##.#.###....##...#..####...##......###..##...#####.##..#..#.#..#####......#....#.##..# +.#.#.###.#...#.##.##.####...###.#.#..#...###.....##..#.#..###.##.#.#...#.##...###....##.#.##..#..### +.#..###.##.####.##..#..#.#.######..#.#..#...#####...##..#..##.#.#.##.##.#...###..##..##...#.##..#... +###.####...###.....#.#####.....#...###.##..#....#.####......#.#..##.#.#.####..#..#...#.#####.#.###.# +#....####...#..#..###...##...##.##....#.#.#....####.#..#.##.#.##.###.#..###.##..###..#.....####....# +.##..#....#..#..#....#...#...##.##..#..###.###...#######.##.##..##.#..#.#..#.#.#.#..####..#####...#. +#.###......#####.###..##.##.#...##.#.###..##..##.....#...########.#..#####......#..###..#.##...#.... +#....##...#.###..##...#..###.####..#.###...##.#.##..####..##.#.#####..#...######....#.##.#..#.....## +.##.#.#.###.#####...#....#......####.##..####..#.#.#.#.#..#.......###.#.....##..##...##..##...###.#. +.#...#.##..#.####.###.###....####..#.##.#....####..#..#...#.####.##.####.#.##.#.####..###......####. +..#.#...#.#.###.##...#...#.......#....#....###.#.......#.#..####.#.###.#.#....#.#.#..#.#..#...#..### +#...###.###.#...#........###...#.##..###.##.#.##..##.....##.#.##...####..#..#.#.##.####.....#.###### +.#.##..#.#.###.#.#.......##.#.##########.#.#.....#..#####.#.....#.#####..###.##......#.#.....####... +.#.#########....###..#.#######.#.....#.#..##...##...#.#####.##....#.#.#..##.....#.#.#.##.#.#..##..## +###.##.#.####.#...###.#.##..####.###...#######..###.#...#.#...##.####..#....####.####..####.#.###... +..##..#...#.#.##...#.###.#########.#..####..###.##..##.##..##...###.#..###...#..#.#..#.#####.###..## +.#.##...#..##.###.....####.#.....#.#.####.#....##..#....##.##.##..#.###.###.####..##..##..##...##### +.##.#.#..####.#.#...#..###.#.##..#.#.###.#..#...###.....#....###..#.#.#.##.###.###..##.#.#.###.##.#. +#..#####.####.....#.#.#...##.#..#.#....#.#####.#.#####...#.#.#.####..#.#####..##.#..#.###..####.#### +#.###...#...#####.###.#.##..##.#.#..##..#..#.##.##.#.....##....#####..##.#.##..#.#......#####.#..#.# +###......#........####.#####..###....#.#.##..#.#.##.##.##.###......###.####...##...##.##.##.#.#.#### +##.#.#.......###..#.##.##....#.####...#..#....#...#.#..#..#..###..#.####.###.##.#..#######..#.#...## +..#....##...#..#...#..#.##.##.###.#.##.####....#..#.#.#.#####.#..#.#.....###.#...###.##.#...#..#.### +#..#..#.....#..###..##.#.##..##.#.#.###.##..##..#######.#..#.#..#.#..##.#...#.#.#.###.##..#.#..####. +..#...##..#.#.##..#.#..#..##..#.###..#########....##...#####.###..#...#.#..##.##......#.##.#..#..... +..##.##....#..#.#..#..####..####..#...##...#..##.##..##..##.#.##.###.............###...###..#####.## +...#####...#..#.#.#..#.##...####.####..###.######..#..###..#...##.###...##.##.#.#######.....#..###.# +####......#.#.#...#####.#.##.#...##.....##..#..#......##.###.###..###.####.##.##..#...###.####..###. +#####....##..##.......#..#...###....#..##.#..#.#.#...#..#..#.#.##.#####...###.....###..#..##....##.# +#.####.##...#.###.#.#.#..###.#..#..###..#.##...#...##..##.#....###......#...#..######.#.#....#..###. +####....##...#.#..###.##.#.....#..#...####.....#...##....####..##.##..#####..##.#.#....###....#.#..# +##..##.##....#####....#..#..####.#####.#.##.###.#...###..#....#..##.#.....#.#..#.###..##.#.#..##.#.. +.##...#.##..#.#.####.##...#...##.#.######..#####.#...#..##.....####...#..########..#.##.....#.#....# +#.#..##..#.#...#...#.#.##..#.#.#.#..#.###..##.#..#.###.....#####.##.#######.###..#..##..#...#.####.# +.#..####.###....##.#..#.#.#.###.##..###..#....##.##.#.######.##...#...#.#.###..#######.###.###.#..#. +.#....##.##..##.#......####.##...####.####.###.###.##.###....#..#.#...##.####.###.###...#..#...##.## +#.##..##.##...#.#####..###....##.####.###.#.#.###..#....##.#.#.#..#.##.###.########.##.#..##..##.##. +.#...#.##.###......#.#####...##..#.#...##.##.....#.##.##.#.#...#..###....####....##....#.#####.#..#. +###..###.####.##..##...#...#.#..###..##..#..#.#####...####..###.#..##..#.###..##....#..#..#.#.#.#... +##.#####..#..#....#.#.##.#.####...####.#..#.....#..##.####......#.#######.##..##..###..#.#.##....### +#.####..#...#..#.##..#.#.....#..#.##.#.#..#...#....##.......#.#.#.#########.######.####....#....#..# +...##...#.#.##...#..##.#.#.#.#..#.#.....#....##.##.###.####.####....#.#.###.##...#.##.....###...##.# +....#.#.#..##....##.#..#.##..#..#.#.###.#..#.#####.#.##.##.##..#..####..###.#.##..#....#.##..###.### +.##.....#.#.......#.###.####.....#.###..##..###..####.##.######........####.##.#.##...##.###..#.###. +.###..#..#.#.#.########..#..#....#.#.#.#...#..#.#...#.###..##.###.####...#....#.#.#####.#...####.### +.##......##.###.###....#.##.#####.#....##..#####.##.##.#.....###...##.....##.##.#..###.....###.#.#.. +....#.##.#.....###.#..#.####...#####...######.##.##..#.#..#.#.#...#.#.##...##....####...##.#.#.#.##. +.#....##.#.#...##.#.........##..#.#......#.#..#.......###.#.###....##.#...#..#.#.#.#.###...##..##### +#..#.#.....#..###.###.#...##..##.#...####..###.#.#..###.###..#..#.#.#.########.#....#.####....####.# +.#..#####.######.#..#..#.##.######.#.###.###.###..###.....#...#.###.###....#.#.##.#..#..#.#...#.##.# +#.#..#..#.#.#.#....#......###...#..##.##...##.####.#.#....#...#.#.##....##.##..#.#.#....####..#.#.#. +..#...##.###......###.#..#.#...##.#.###.###.#.####......#..#...#..######.#.##.########..#..#.#...... +....##.#.##.##..#..###.....###...#.#.##...#.######....###...##.##..##..##.##....#.#.##..###...##.#.# +####.#.###.###.###.#.####..#.......######..##....####.#.####......#...#.#####..#.###..######.#.#.#.# +#.........##...#.#.#####...#.##..#.#..#.##.##..#.###..##.#..###.##..###.#..######..#.####...#.####.# +..#.#.####....#.#####.###....###..#...#...#.#..###.##.##..#.....##......##.#...#.###...##.#########. +##..####.....##.#......#..#....##.##.#..##.#..##.##...#.#...#.#..##.....######.#.##..#...#....##.#.# +.#.##..#.##.#...##...##..##.#.#..####......#...######.###.###.##..#.#.........###..#.#.#......#....# +##.###.###..#....#....#...#.##.#.####..#...#.#.##.#.##.#.#...#.#.#...##..#....######....####...#.#.# +.####.#.....#####..#....#.#.##..##..#...#.####.##.#..###..###.#...###.####...##.##..#....#.#.#..##.. +####.#....##..####...#.#.#..###..#####.#.#.#..##.####.##.#......###.#...#.##.#......#..##.#...#.##.# +#....##.....#.##.#####..#.#.###....#.#...#.####.#.#...###..##...#.###.###......#.#...#..##..##.##### +##.#..#.##..###.#.######...#.#.#...#......###......#..#..##....###.####..##.###...##.#...#..#.##.... +.##...#.#.####.#.##..#.#.....##....#.##.###.#.#...##.####...#.#..#.###...##.######.##.###.....#...#. +##...##.#...#.#......##.#..#...##.######.####.#.##.##.###.##..#........##.#.#...#.#.##.#..##.#.#.#.# +#..##.#..##.#.##..##.#...###...#####.##...######...#.##.##..#.##.#.#..#########.#......###.#.##...## +..#.#.#..###......##.##.###.##.##.##.##.......##....#####..####.##..##.##..#....##....#......#..#..# +...###..##....##..#.#######..######..#............#.....#..#.#.#....####.#.##.#.#.....###...#.#...#. +###.#....#...##....#.#..##....###..##..###..#.#..##.##......#....#...#...####.....#..##....##..#..## +#.##.#...###.##..#..#.######....###.#...#....#.###......#.###.#...#.#..##..##..#....#.....#...##.### +...##...##....##.....#....#.#####.##..##.###.###.#.....#..#...#.####.#.#..#..#.###.##....##..#..#..# +##.##.###..#.#.....#.....##...#....#..#........#..#.##.###..#.........#...#.##.##.###..#...#####..## +..###.#.#.####.....####...#.#..#....##.###..###.##...#.#...#.####..####.#.#..#.#####.#......#.###... +.####....###.#...###...#.##.####.....#.#....#..#.##..#.#.#....##.#..#.###..##..#..#.#.####.#....#### +###.#....#..##..##.####.##.#.#....##.......#..#......##..#.##.#####..###..#....###.#.........#..#.#. +..#....##...#...###.##.#..#..#....##.#####..##..#.####...#.#..##..##....##...##..###.#.###.##.#..### +......##.#######...#...#..##...##.#..#.......#..##...#.#.###.###..##.#...###..##.##.#.##.#..######.. +##..#...#.###..####.####..###.#.##..#.#.##.#..#.##.....##..###...#.##..#....###..##...###.....#.#... +.##.#.#...#.#..#.#######.##.#.#..#..###..#.##.#..#####.#.###.###..####....#.####.....###...###..##.# +#...#...##.###.#..##..#..##...#.###.....#..####..#..#.#.#.##.#.#.##..#.##.#...##..###.#..#.#..#.#... +#.#..##....#.#.##.##..##..#.##.#####.##..####.#.#.#......#.######.......##...#...#.##.#..####..#.### +...#..#.....##.#.#.###.....######..#.##.....##....##..###.####..##.##.###.#.....###.###.#.#..##..#.. +##.#...##.#..###.#.#.##..#...###..##.###.###...#...#.#.##.#.##.#...####.####..###..#.##.#.##..##.##. diff --git a/inputs/test_input20_1_0 b/inputs/test_input20_1_0 new file mode 100644 index 0000000..8fa4bd4 --- /dev/null +++ b/inputs/test_input20_1_0 @@ -0,0 +1,7 @@ +..#.#..#####.#.#.#.###.##.....###.##.#..###.####..#####..#....#..#..##..###..######.###...####..#..#####..##..#.#####...##.#.#..#.##..#.#......#.###.######.###.####...#.##.##..#..#..#####.....#.#....###..#.##......#.....#..#..#..##..#...##.######.####.####.#.#...#.......#..#.#.#...####.##.#......#..#...##.#.##..#...##.#.##..###.#......#.#.......#.#.#.####.###.##...#.....####.#..#..#.##.#....##..#.####....##...##..#...#......#.#.......#.......##..####..#...#.#.#...##..#.#..###..#####........#..####......#..# + +#..#. +#.... +##..# +..#.. +..### diff --git a/inputs/test_input20_1_1 b/inputs/test_input20_1_1 new file mode 100644 index 0000000..23527b3 --- /dev/null +++ b/inputs/test_input20_1_1 @@ -0,0 +1,102 @@ +###.#.##.##....##...##.#..##...#..##.#.#.#.##.##...#.##.#...#.#.#.#.#...##.#...#####..#...#.#.#...##.#.####.##.##.###......###.#.###...#..##.#..#..##.##.#..###.###.#.#...#.##.######..####..##..#.#.#####.##.###..###.#.#.#....##.#.####.....#..#..#.##.#.##...##.#...###......###.#....#..#......#.##.#..##.#.###.###.####.##..###.#...#.##.####.#.##..#.#..#.#.......#.####..#..##..###.####..##.#.##.###....#.###..####..##......###.##.#.#...#..####.##.#...#..###..##..####.###...#.#..##.#.###.#.....##..#...###..####... + +##..###.#.###..##.##..####.#..#.#.###..#.#.#....#.#.###...#.....#.##.##..#.####.##.#.####.#.#.....## +...#.#.###...###..##...#####..##..#..#.#..#.#...#.#..###...#..##.##....#.....#...########.######.##. +#...#.#.####....#....###..#.#.###.#.....####....###.#.###.#..###.###....##.##..#.##...##....##.##... +###..###.#..#######.....#..##.###..#####...##.###..#....##.##....####...#..###..###.#...##...###.### +#######.#........#####.##..##..#...#######..#.##...#.###...###...######...#####..#.#.#..#..#.#.#.#.. +..##.#.##.##.#...#.#.#........##.##.###..###.##.#.#.#.#..##.#.###..######..#.....#..#.###..#....#.#. +.#.....##.#...#.###...#.##..#.##.##.#.#.#####...###.#.##.###..#.#.#..#..##########.#.#####.##.#..##. +.#.#.##..#.#.####..#...#.#..##.########.#.###.#.#......##..########.####.##...###....###......#.#.## +##.#.#.#######..#....###...##.#.#.#..#.#.###.###..#....#..###....#.....##.####.##..##..##..#.###.... +.##..#######.######....#.#..#.......#.#.####.#.####.....#.####..##.#..##..##..#......#...###...#..#. +###.#..###..##..#.##...###.####...##........#..##.#.#.#.##...####...##..#..#.####......##..#..##.##. +#.#.##...#.##......#.......###.......##...#...#####.#.#..##..#..#####.###.######..###.###......##.## +#.#####.#.#..#...#.#..###.###.....###.##...#.##.##.###..#...##..##...#####...#.....##.#..####.#.###. +..######..###.#.#...#.#.##......###......#.#######..#.#....#.##....#..#.#.##....###.##.#.#...#...##. +##.##..#.##.##.#.#####.#####.##.#.##.#...##..##....##....###....##.###..##.###.#.#...##....##.#.##.# +.#.##.#.#.#.##...#.#.###.#...#.#....####.##.#..#####.#.#..######.##..#.#.#####....###..##..#.#...... +..###.....#.###.......#...#...##.#...##.##..##.##..##...###.#..#...##..#.#.#.##...#.#..#####.##..#.# +.##..#...#.##.##.#.###....##...#..####...##......###..##...#####.##..#..#.#..#####......#....#.##..# +.#.#.###.#...#.##.##.####...###.#.#..#...###.....##..#.#..###.##.#.#...#.##...###....##.#.##..#..### +.#..###.##.####.##..#..#.#.######..#.#..#...#####...##..#..##.#.#.##.##.#...###..##..##...#.##..#... +###.####...###.....#.#####.....#...###.##..#....#.####......#.#..##.#.#.####..#..#...#.#####.#.###.# +#....####...#..#..###...##...##.##....#.#.#....####.#..#.##.#.##.###.#..###.##..###..#.....####....# +.##..#....#..#..#....#...#...##.##..#..###.###...#######.##.##..##.#..#.#..#.#.#.#..####..#####...#. +#.###......#####.###..##.##.#...##.#.###..##..##.....#...########.#..#####......#..###..#.##...#.... +#....##...#.###..##...#..###.####..#.###...##.#.##..####..##.#.#####..#...######....#.##.#..#.....## +.##.#.#.###.#####...#....#......####.##..####..#.#.#.#.#..#.......###.#.....##..##...##..##...###.#. +.#...#.##..#.####.###.###....####..#.##.#....####..#..#...#.####.##.####.#.##.#.####..###......####. +..#.#...#.#.###.##...#...#.......#....#....###.#.......#.#..####.#.###.#.#....#.#.#..#.#..#...#..### +#...###.###.#...#........###...#.##..###.##.#.##..##.....##.#.##...####..#..#.#.##.####.....#.###### +.#.##..#.#.###.#.#.......##.#.##########.#.#.....#..#####.#.....#.#####..###.##......#.#.....####... +.#.#########....###..#.#######.#.....#.#..##...##...#.#####.##....#.#.#..##.....#.#.#.##.#.#..##..## +###.##.#.####.#...###.#.##..####.###...#######..###.#...#.#...##.####..#....####.####..####.#.###... +..##..#...#.#.##...#.###.#########.#..####..###.##..##.##..##...###.#..###...#..#.#..#.#####.###..## +.#.##...#..##.###.....####.#.....#.#.####.#....##..#....##.##.##..#.###.###.####..##..##..##...##### +.##.#.#..####.#.#...#..###.#.##..#.#.###.#..#...###.....#....###..#.#.#.##.###.###..##.#.#.###.##.#. +#..#####.####.....#.#.#...##.#..#.#....#.#####.#.#####...#.#.#.####..#.#####..##.#..#.###..####.#### +#.###...#...#####.###.#.##..##.#.#..##..#..#.##.##.#.....##....#####..##.#.##..#.#......#####.#..#.# +###......#........####.#####..###....#.#.##..#.#.##.##.##.###......###.####...##...##.##.##.#.#.#### +##.#.#.......###..#.##.##....#.####...#..#....#...#.#..#..#..###..#.####.###.##.#..#######..#.#...## +..#....##...#..#...#..#.##.##.###.#.##.####....#..#.#.#.#####.#..#.#.....###.#...###.##.#...#..#.### +#..#..#.....#..###..##.#.##..##.#.#.###.##..##..#######.#..#.#..#.#..##.#...#.#.#.###.##..#.#..####. +..#...##..#.#.##..#.#..#..##..#.###..#########....##...#####.###..#...#.#..##.##......#.##.#..#..... +..##.##....#..#.#..#..####..####..#...##...#..##.##..##..##.#.##.###.............###...###..#####.## +...#####...#..#.#.#..#.##...####.####..###.######..#..###..#...##.###...##.##.#.#######.....#..###.# +####......#.#.#...#####.#.##.#...##.....##..#..#......##.###.###..###.####.##.##..#...###.####..###. +#####....##..##.......#..#...###....#..##.#..#.#.#...#..#..#.#.##.#####...###.....###..#..##....##.# +#.####.##...#.###.#.#.#..###.#..#..###..#.##...#...##..##.#....###......#...#..######.#.#....#..###. +####....##...#.#..###.##.#.....#..#...####.....#...##....####..##.##..#####..##.#.#....###....#.#..# +##..##.##....#####....#..#..####.#####.#.##.###.#...###..#....#..##.#.....#.#..#.###..##.#.#..##.#.. +.##...#.##..#.#.####.##...#...##.#.######..#####.#...#..##.....####...#..########..#.##.....#.#....# +#.#..##..#.#...#...#.#.##..#.#.#.#..#.###..##.#..#.###.....#####.##.#######.###..#..##..#...#.####.# +.#..####.###....##.#..#.#.#.###.##..###..#....##.##.#.######.##...#...#.#.###..#######.###.###.#..#. +.#....##.##..##.#......####.##...####.####.###.###.##.###....#..#.#...##.####.###.###...#..#...##.## +#.##..##.##...#.#####..###....##.####.###.#.#.###..#....##.#.#.#..#.##.###.########.##.#..##..##.##. +.#...#.##.###......#.#####...##..#.#...##.##.....#.##.##.#.#...#..###....####....##....#.#####.#..#. +###..###.####.##..##...#...#.#..###..##..#..#.#####...####..###.#..##..#.###..##....#..#..#.#.#.#... +##.#####..#..#....#.#.##.#.####...####.#..#.....#..##.####......#.#######.##..##..###..#.#.##....### +#.####..#...#..#.##..#.#.....#..#.##.#.#..#...#....##.......#.#.#.#########.######.####....#....#..# +...##...#.#.##...#..##.#.#.#.#..#.#.....#....##.##.###.####.####....#.#.###.##...#.##.....###...##.# +....#.#.#..##....##.#..#.##..#..#.#.###.#..#.#####.#.##.##.##..#..####..###.#.##..#....#.##..###.### +.##.....#.#.......#.###.####.....#.###..##..###..####.##.######........####.##.#.##...##.###..#.###. +.###..#..#.#.#.########..#..#....#.#.#.#...#..#.#...#.###..##.###.####...#....#.#.#####.#...####.### +.##......##.###.###....#.##.#####.#....##..#####.##.##.#.....###...##.....##.##.#..###.....###.#.#.. +....#.##.#.....###.#..#.####...#####...######.##.##..#.#..#.#.#...#.#.##...##....####...##.#.#.#.##. +.#....##.#.#...##.#.........##..#.#......#.#..#.......###.#.###....##.#...#..#.#.#.#.###...##..##### +#..#.#.....#..###.###.#...##..##.#...####..###.#.#..###.###..#..#.#.#.########.#....#.####....####.# +.#..#####.######.#..#..#.##.######.#.###.###.###..###.....#...#.###.###....#.#.##.#..#..#.#...#.##.# +#.#..#..#.#.#.#....#......###...#..##.##...##.####.#.#....#...#.#.##....##.##..#.#.#....####..#.#.#. +..#...##.###......###.#..#.#...##.#.###.###.#.####......#..#...#..######.#.##.########..#..#.#...... +....##.#.##.##..#..###.....###...#.#.##...#.######....###...##.##..##..##.##....#.#.##..###...##.#.# +####.#.###.###.###.#.####..#.......######..##....####.#.####......#...#.#####..#.###..######.#.#.#.# +#.........##...#.#.#####...#.##..#.#..#.##.##..#.###..##.#..###.##..###.#..######..#.####...#.####.# +..#.#.####....#.#####.###....###..#...#...#.#..###.##.##..#.....##......##.#...#.###...##.#########. +##..####.....##.#......#..#....##.##.#..##.#..##.##...#.#...#.#..##.....######.#.##..#...#....##.#.# +.#.##..#.##.#...##...##..##.#.#..####......#...######.###.###.##..#.#.........###..#.#.#......#....# +##.###.###..#....#....#...#.##.#.####..#...#.#.##.#.##.#.#...#.#.#...##..#....######....####...#.#.# +.####.#.....#####..#....#.#.##..##..#...#.####.##.#..###..###.#...###.####...##.##..#....#.#.#..##.. +####.#....##..####...#.#.#..###..#####.#.#.#..##.####.##.#......###.#...#.##.#......#..##.#...#.##.# +#....##.....#.##.#####..#.#.###....#.#...#.####.#.#...###..##...#.###.###......#.#...#..##..##.##### +##.#..#.##..###.#.######...#.#.#...#......###......#..#..##....###.####..##.###...##.#...#..#.##.... +.##...#.#.####.#.##..#.#.....##....#.##.###.#.#...##.####...#.#..#.###...##.######.##.###.....#...#. +##...##.#...#.#......##.#..#...##.######.####.#.##.##.###.##..#........##.#.#...#.#.##.#..##.#.#.#.# +#..##.#..##.#.##..##.#...###...#####.##...######...#.##.##..#.##.#.#..#########.#......###.#.##...## +..#.#.#..###......##.##.###.##.##.##.##.......##....#####..####.##..##.##..#....##....#......#..#..# +...###..##....##..#.#######..######..#............#.....#..#.#.#....####.#.##.#.#.....###...#.#...#. +###.#....#...##....#.#..##....###..##..###..#.#..##.##......#....#...#...####.....#..##....##..#..## +#.##.#...###.##..#..#.######....###.#...#....#.###......#.###.#...#.#..##..##..#....#.....#...##.### +...##...##....##.....#....#.#####.##..##.###.###.#.....#..#...#.####.#.#..#..#.###.##....##..#..#..# +##.##.###..#.#.....#.....##...#....#..#........#..#.##.###..#.........#...#.##.##.###..#...#####..## +..###.#.#.####.....####...#.#..#....##.###..###.##...#.#...#.####..####.#.#..#.#####.#......#.###... +.####....###.#...###...#.##.####.....#.#....#..#.##..#.#.#....##.#..#.###..##..#..#.#.####.#....#### +###.#....#..##..##.####.##.#.#....##.......#..#......##..#.##.#####..###..#....###.#.........#..#.#. +..#....##...#...###.##.#..#..#....##.#####..##..#.####...#.#..##..##....##...##..###.#.###.##.#..### +......##.#######...#...#..##...##.#..#.......#..##...#.#.###.###..##.#...###..##.##.#.##.#..######.. +##..#...#.###..####.####..###.#.##..#.#.##.#..#.##.....##..###...#.##..#....###..##...###.....#.#... +.##.#.#...#.#..#.#######.##.#.#..#..###..#.##.#..#####.#.###.###..####....#.####.....###...###..##.# +#...#...##.###.#..##..#..##...#.###.....#..####..#..#.#.#.##.#.#.##..#.##.#...##..###.#..#.#..#.#... +#.#..##....#.#.##.##..##..#.##.#####.##..####.#.#.#......#.######.......##...#...#.##.#..####..#.### +...#..#.....##.#.#.###.....######..#.##.....##....##..###.####..##.##.###.#.....###.###.#.#..##..#.. +##.#...##.#..###.#.#.##..#...###..##.###.###...#...#.#.##.#.##.#...####.####..###..#.##.#.##..##.##. diff --git a/inputs/test_input20_2_0 b/inputs/test_input20_2_0 new file mode 100644 index 0000000..8fa4bd4 --- /dev/null +++ b/inputs/test_input20_2_0 @@ -0,0 +1,7 @@ +..#.#..#####.#.#.#.###.##.....###.##.#..###.####..#####..#....#..#..##..###..######.###...####..#..#####..##..#.#####...##.#.#..#.##..#.#......#.###.######.###.####...#.##.##..#..#..#####.....#.#....###..#.##......#.....#..#..#..##..#...##.######.####.####.#.#...#.......#..#.#.#...####.##.#......#..#...##.#.##..#...##.#.##..###.#......#.#.......#.#.#.####.###.##...#.....####.#..#..#.##.#....##..#.####....##...##..#...#......#.#.......#.......##..####..#...#.#.#...##..#.#..###..#####........#..####......#..# + +#..#. +#.... +##..# +..#.. +..### diff --git a/inputs/test_input20_2_1 b/inputs/test_input20_2_1 new file mode 100644 index 0000000..23527b3 --- /dev/null +++ b/inputs/test_input20_2_1 @@ -0,0 +1,102 @@ +###.#.##.##....##...##.#..##...#..##.#.#.#.##.##...#.##.#...#.#.#.#.#...##.#...#####..#...#.#.#...##.#.####.##.##.###......###.#.###...#..##.#..#..##.##.#..###.###.#.#...#.##.######..####..##..#.#.#####.##.###..###.#.#.#....##.#.####.....#..#..#.##.#.##...##.#...###......###.#....#..#......#.##.#..##.#.###.###.####.##..###.#...#.##.####.#.##..#.#..#.#.......#.####..#..##..###.####..##.#.##.###....#.###..####..##......###.##.#.#...#..####.##.#...#..###..##..####.###...#.#..##.#.###.#.....##..#...###..####... + +##..###.#.###..##.##..####.#..#.#.###..#.#.#....#.#.###...#.....#.##.##..#.####.##.#.####.#.#.....## +...#.#.###...###..##...#####..##..#..#.#..#.#...#.#..###...#..##.##....#.....#...########.######.##. +#...#.#.####....#....###..#.#.###.#.....####....###.#.###.#..###.###....##.##..#.##...##....##.##... +###..###.#..#######.....#..##.###..#####...##.###..#....##.##....####...#..###..###.#...##...###.### +#######.#........#####.##..##..#...#######..#.##...#.###...###...######...#####..#.#.#..#..#.#.#.#.. +..##.#.##.##.#...#.#.#........##.##.###..###.##.#.#.#.#..##.#.###..######..#.....#..#.###..#....#.#. +.#.....##.#...#.###...#.##..#.##.##.#.#.#####...###.#.##.###..#.#.#..#..##########.#.#####.##.#..##. +.#.#.##..#.#.####..#...#.#..##.########.#.###.#.#......##..########.####.##...###....###......#.#.## +##.#.#.#######..#....###...##.#.#.#..#.#.###.###..#....#..###....#.....##.####.##..##..##..#.###.... +.##..#######.######....#.#..#.......#.#.####.#.####.....#.####..##.#..##..##..#......#...###...#..#. +###.#..###..##..#.##...###.####...##........#..##.#.#.#.##...####...##..#..#.####......##..#..##.##. +#.#.##...#.##......#.......###.......##...#...#####.#.#..##..#..#####.###.######..###.###......##.## +#.#####.#.#..#...#.#..###.###.....###.##...#.##.##.###..#...##..##...#####...#.....##.#..####.#.###. +..######..###.#.#...#.#.##......###......#.#######..#.#....#.##....#..#.#.##....###.##.#.#...#...##. +##.##..#.##.##.#.#####.#####.##.#.##.#...##..##....##....###....##.###..##.###.#.#...##....##.#.##.# +.#.##.#.#.#.##...#.#.###.#...#.#....####.##.#..#####.#.#..######.##..#.#.#####....###..##..#.#...... +..###.....#.###.......#...#...##.#...##.##..##.##..##...###.#..#...##..#.#.#.##...#.#..#####.##..#.# +.##..#...#.##.##.#.###....##...#..####...##......###..##...#####.##..#..#.#..#####......#....#.##..# +.#.#.###.#...#.##.##.####...###.#.#..#...###.....##..#.#..###.##.#.#...#.##...###....##.#.##..#..### +.#..###.##.####.##..#..#.#.######..#.#..#...#####...##..#..##.#.#.##.##.#...###..##..##...#.##..#... +###.####...###.....#.#####.....#...###.##..#....#.####......#.#..##.#.#.####..#..#...#.#####.#.###.# +#....####...#..#..###...##...##.##....#.#.#....####.#..#.##.#.##.###.#..###.##..###..#.....####....# +.##..#....#..#..#....#...#...##.##..#..###.###...#######.##.##..##.#..#.#..#.#.#.#..####..#####...#. +#.###......#####.###..##.##.#...##.#.###..##..##.....#...########.#..#####......#..###..#.##...#.... +#....##...#.###..##...#..###.####..#.###...##.#.##..####..##.#.#####..#...######....#.##.#..#.....## +.##.#.#.###.#####...#....#......####.##..####..#.#.#.#.#..#.......###.#.....##..##...##..##...###.#. +.#...#.##..#.####.###.###....####..#.##.#....####..#..#...#.####.##.####.#.##.#.####..###......####. +..#.#...#.#.###.##...#...#.......#....#....###.#.......#.#..####.#.###.#.#....#.#.#..#.#..#...#..### +#...###.###.#...#........###...#.##..###.##.#.##..##.....##.#.##...####..#..#.#.##.####.....#.###### +.#.##..#.#.###.#.#.......##.#.##########.#.#.....#..#####.#.....#.#####..###.##......#.#.....####... +.#.#########....###..#.#######.#.....#.#..##...##...#.#####.##....#.#.#..##.....#.#.#.##.#.#..##..## +###.##.#.####.#...###.#.##..####.###...#######..###.#...#.#...##.####..#....####.####..####.#.###... +..##..#...#.#.##...#.###.#########.#..####..###.##..##.##..##...###.#..###...#..#.#..#.#####.###..## +.#.##...#..##.###.....####.#.....#.#.####.#....##..#....##.##.##..#.###.###.####..##..##..##...##### +.##.#.#..####.#.#...#..###.#.##..#.#.###.#..#...###.....#....###..#.#.#.##.###.###..##.#.#.###.##.#. +#..#####.####.....#.#.#...##.#..#.#....#.#####.#.#####...#.#.#.####..#.#####..##.#..#.###..####.#### +#.###...#...#####.###.#.##..##.#.#..##..#..#.##.##.#.....##....#####..##.#.##..#.#......#####.#..#.# +###......#........####.#####..###....#.#.##..#.#.##.##.##.###......###.####...##...##.##.##.#.#.#### +##.#.#.......###..#.##.##....#.####...#..#....#...#.#..#..#..###..#.####.###.##.#..#######..#.#...## +..#....##...#..#...#..#.##.##.###.#.##.####....#..#.#.#.#####.#..#.#.....###.#...###.##.#...#..#.### +#..#..#.....#..###..##.#.##..##.#.#.###.##..##..#######.#..#.#..#.#..##.#...#.#.#.###.##..#.#..####. +..#...##..#.#.##..#.#..#..##..#.###..#########....##...#####.###..#...#.#..##.##......#.##.#..#..... +..##.##....#..#.#..#..####..####..#...##...#..##.##..##..##.#.##.###.............###...###..#####.## +...#####...#..#.#.#..#.##...####.####..###.######..#..###..#...##.###...##.##.#.#######.....#..###.# +####......#.#.#...#####.#.##.#...##.....##..#..#......##.###.###..###.####.##.##..#...###.####..###. +#####....##..##.......#..#...###....#..##.#..#.#.#...#..#..#.#.##.#####...###.....###..#..##....##.# +#.####.##...#.###.#.#.#..###.#..#..###..#.##...#...##..##.#....###......#...#..######.#.#....#..###. +####....##...#.#..###.##.#.....#..#...####.....#...##....####..##.##..#####..##.#.#....###....#.#..# +##..##.##....#####....#..#..####.#####.#.##.###.#...###..#....#..##.#.....#.#..#.###..##.#.#..##.#.. +.##...#.##..#.#.####.##...#...##.#.######..#####.#...#..##.....####...#..########..#.##.....#.#....# +#.#..##..#.#...#...#.#.##..#.#.#.#..#.###..##.#..#.###.....#####.##.#######.###..#..##..#...#.####.# +.#..####.###....##.#..#.#.#.###.##..###..#....##.##.#.######.##...#...#.#.###..#######.###.###.#..#. +.#....##.##..##.#......####.##...####.####.###.###.##.###....#..#.#...##.####.###.###...#..#...##.## +#.##..##.##...#.#####..###....##.####.###.#.#.###..#....##.#.#.#..#.##.###.########.##.#..##..##.##. +.#...#.##.###......#.#####...##..#.#...##.##.....#.##.##.#.#...#..###....####....##....#.#####.#..#. +###..###.####.##..##...#...#.#..###..##..#..#.#####...####..###.#..##..#.###..##....#..#..#.#.#.#... +##.#####..#..#....#.#.##.#.####...####.#..#.....#..##.####......#.#######.##..##..###..#.#.##....### +#.####..#...#..#.##..#.#.....#..#.##.#.#..#...#....##.......#.#.#.#########.######.####....#....#..# +...##...#.#.##...#..##.#.#.#.#..#.#.....#....##.##.###.####.####....#.#.###.##...#.##.....###...##.# +....#.#.#..##....##.#..#.##..#..#.#.###.#..#.#####.#.##.##.##..#..####..###.#.##..#....#.##..###.### +.##.....#.#.......#.###.####.....#.###..##..###..####.##.######........####.##.#.##...##.###..#.###. +.###..#..#.#.#.########..#..#....#.#.#.#...#..#.#...#.###..##.###.####...#....#.#.#####.#...####.### +.##......##.###.###....#.##.#####.#....##..#####.##.##.#.....###...##.....##.##.#..###.....###.#.#.. +....#.##.#.....###.#..#.####...#####...######.##.##..#.#..#.#.#...#.#.##...##....####...##.#.#.#.##. +.#....##.#.#...##.#.........##..#.#......#.#..#.......###.#.###....##.#...#..#.#.#.#.###...##..##### +#..#.#.....#..###.###.#...##..##.#...####..###.#.#..###.###..#..#.#.#.########.#....#.####....####.# +.#..#####.######.#..#..#.##.######.#.###.###.###..###.....#...#.###.###....#.#.##.#..#..#.#...#.##.# +#.#..#..#.#.#.#....#......###...#..##.##...##.####.#.#....#...#.#.##....##.##..#.#.#....####..#.#.#. +..#...##.###......###.#..#.#...##.#.###.###.#.####......#..#...#..######.#.##.########..#..#.#...... +....##.#.##.##..#..###.....###...#.#.##...#.######....###...##.##..##..##.##....#.#.##..###...##.#.# +####.#.###.###.###.#.####..#.......######..##....####.#.####......#...#.#####..#.###..######.#.#.#.# +#.........##...#.#.#####...#.##..#.#..#.##.##..#.###..##.#..###.##..###.#..######..#.####...#.####.# +..#.#.####....#.#####.###....###..#...#...#.#..###.##.##..#.....##......##.#...#.###...##.#########. +##..####.....##.#......#..#....##.##.#..##.#..##.##...#.#...#.#..##.....######.#.##..#...#....##.#.# +.#.##..#.##.#...##...##..##.#.#..####......#...######.###.###.##..#.#.........###..#.#.#......#....# +##.###.###..#....#....#...#.##.#.####..#...#.#.##.#.##.#.#...#.#.#...##..#....######....####...#.#.# +.####.#.....#####..#....#.#.##..##..#...#.####.##.#..###..###.#...###.####...##.##..#....#.#.#..##.. +####.#....##..####...#.#.#..###..#####.#.#.#..##.####.##.#......###.#...#.##.#......#..##.#...#.##.# +#....##.....#.##.#####..#.#.###....#.#...#.####.#.#...###..##...#.###.###......#.#...#..##..##.##### +##.#..#.##..###.#.######...#.#.#...#......###......#..#..##....###.####..##.###...##.#...#..#.##.... +.##...#.#.####.#.##..#.#.....##....#.##.###.#.#...##.####...#.#..#.###...##.######.##.###.....#...#. +##...##.#...#.#......##.#..#...##.######.####.#.##.##.###.##..#........##.#.#...#.#.##.#..##.#.#.#.# +#..##.#..##.#.##..##.#...###...#####.##...######...#.##.##..#.##.#.#..#########.#......###.#.##...## +..#.#.#..###......##.##.###.##.##.##.##.......##....#####..####.##..##.##..#....##....#......#..#..# +...###..##....##..#.#######..######..#............#.....#..#.#.#....####.#.##.#.#.....###...#.#...#. +###.#....#...##....#.#..##....###..##..###..#.#..##.##......#....#...#...####.....#..##....##..#..## +#.##.#...###.##..#..#.######....###.#...#....#.###......#.###.#...#.#..##..##..#....#.....#...##.### +...##...##....##.....#....#.#####.##..##.###.###.#.....#..#...#.####.#.#..#..#.###.##....##..#..#..# +##.##.###..#.#.....#.....##...#....#..#........#..#.##.###..#.........#...#.##.##.###..#...#####..## +..###.#.#.####.....####...#.#..#....##.###..###.##...#.#...#.####..####.#.#..#.#####.#......#.###... +.####....###.#...###...#.##.####.....#.#....#..#.##..#.#.#....##.#..#.###..##..#..#.#.####.#....#### +###.#....#..##..##.####.##.#.#....##.......#..#......##..#.##.#####..###..#....###.#.........#..#.#. +..#....##...#...###.##.#..#..#....##.#####..##..#.####...#.#..##..##....##...##..###.#.###.##.#..### +......##.#######...#...#..##...##.#..#.......#..##...#.#.###.###..##.#...###..##.##.#.##.#..######.. +##..#...#.###..####.####..###.#.##..#.#.##.#..#.##.....##..###...#.##..#....###..##...###.....#.#... +.##.#.#...#.#..#.#######.##.#.#..#..###..#.##.#..#####.#.###.###..####....#.####.....###...###..##.# +#...#...##.###.#..##..#..##...#.###.....#..####..#..#.#.#.##.#.#.##..#.##.#...##..###.#..#.#..#.#... +#.#..##....#.#.##.##..##..#.##.#####.##..####.#.#.#......#.######.......##...#...#.##.#..####..#.### +...#..#.....##.#.#.###.....######..#.##.....##....##..###.####..##.##.###.#.....###.###.#.#..##..#.. +##.#...##.#..###.#.#.##..#...###..##.###.###...#...#.#.##.#.##.#...####.####..###..#.##.#.##..##.##. diff --git a/notes b/notes new file mode 100644 index 0000000..5df1aaa --- /dev/null +++ b/notes @@ -0,0 +1,3 @@ +5425 +5570 +5578