diff --git a/23/elixir/inputs/day13.txt b/23/elixir/inputs/day13.txt new file mode 100644 index 0000000..90797da --- /dev/null +++ b/23/elixir/inputs/day13.txt @@ -0,0 +1,1385 @@ +#.#.####.#.#.## +.#.##..##.#...# +.#..#..#..#.#.. +.##..##..##.#.# +....####....... +##...##...##..# +##...##...##..# +....####....... +.##..##..##.#.# +.#..#..#..#.#.. +.#.##..##.#...# +#.#.####.#.#.#. +..#.#..#.#....# +##.#.##.#.####. +..#..##..#....# +#..#.##.#..#.## +#.#.####.#.#... + +..#.....##. +.#..#..##.# +.......###. +####.##.#.# +###.###.... +###.###.... +####.##.#.# +.......#### +.#..#..##.# +..#.....##. +..#.....##. +.#..#..##.# +.......#### + +##.#.##...####. +#####..#...##.. +##.##.#.#####.# +.##.#..##..##.. +###..#.#####.#. +###..#.#####.#. +.##.#..##..##.. +##.##.#.#####.# +#####..#...##.. +##.#.##..#####. +...#...#....### +##.#.###.###..# +..#.###.#.#.... +####...#.#.#... +.#..#....##.#.# +....####.###.## +....####.###.## + +...#.###.###### +..##.##.##.##.# +####.#....#..#. +.#...#.#.#.##.# +.#..#.#.####### +##..#.#.####### +.#...#.#.#.##.# + +..##..##... +..#.##.#.## +...#.#.#... +##.#.####.. +...###.#.## +######.#.## +######..#.# + +.#..###.# +.###.##.# +....###.# +.######.. +...#.#.#. +...#.#.#. +.######.. +....###.# +.###.##.# +.#..###.# +####...## +..##.#..# +..##....# +####...## +.#..###.# + +##..####### +.#..#.#..#. +##..####### +.####..##.. +#....#.##.# +..##.#.##.# +#....###### + +##.###.#...## +######..##.## +######..##.## +##.###.#...## +.##.####...#. +####.##.#.#.. +##..###...### +#......#.#... +#...###.##.## +.#####...##.. +.##..###..... +.##.......#.. +#.######.##.. + +...#..........#.. +###.###....###.## +##.###.####.###.# +..###.#.##.#.###. +...##.#.##.#.##.. +#####........#### +..#.#.##..##.#.#. +..#####.##.#####. +...#...####...#.. +##..##..##..##..# +....#.##..##.#... +..#.####..####.#. +...##.##..##.##.. +..##..........##. +.....#..##..#..#. +###.#........#.## +..#...#.##.#...#. + +....####... +.##..##.### +.##..##.### +....####... +..#..#..... +####.#.###. +.###.###.## +...##...#.. +#...####.## +..#.####### +##..####.## + +..#######.# +##.#.###... +##.....##.# +#.#.###...# +...#..##.#. +...#..##.#. +#.#.###...# +##.....#..# +##.#.###... +..#######.# +#.##..#.#.# +#.##.##..## +#.##.##..## +#.##..#.#.# +..#######.# +##.#.###... +##.....#..# + +..#...#..#...#..# +########...##.##. +.#..#.#.#.#.##### +..##...##..##.... +.......########## +.#..#.##.#.#..##. +########...###..# +..##...###.##.... +#....#..#.#...... +##..###..#....... +##..##.##.##..##. + +####...## +......##. +.##.#.#.. +.......#. +.##.###.. +.##.##.#. +#..##.##. +....#.#.. +...#..#.. +.##..#... +.##.###.. +#..##..#. +#..##..#. + +##.#... +.###... +###...# +##.###. +...#... +...#.#. +###.### +....#.# +....#.# + +..#.#.#.......# +..#.#.#.......# +.#.#.#.#####.## +.##..###.#.#### +#.######.#.#.#. +#####.####.#.## +#####.####.#.## +#.######.#.#.#. +.##..###.#.#.## + +..#..#.##.# +..#..#.##.# +...#.#.#.## +.#...#..... +##...##.... +..#.#..#.#. +..#..#.#... +...#####... +...##.#..#. + +.##.######... +.....####.#.. +#..##.#..#.## +.##.###.#.### +#..#.####..## +....#..#.#... +####....#.... +####..##..... +.##.#....#### +###.###...#.. +.##......#... +.##..#..##.## +#..#..#.###.. +.....###..### +....#....#.## +.##..######## +.##..#.###... + +.#.####.#.##...## +..#.##.#......#.# +..#.##.#......#.# +.#.####.#.##...## +##..##..#...#..#. +#...##...##.###.. +##......##.#...#. + +#....##.#....## +#....#...#.#... +..##..#.#.##### +.#.##.#####.### +.#.##.#####.### +..##..#.#..#### +#....#...#.#... +#....##.#....## +.###.##.#...#.. +.#..###...#..## +#...#..###.#... +..###.##.##..## +#...##....#.#.. + +.##...#.....### +#..###.#..##### +#..#......###.. +.##.#####.##... +.##.#.##.#.#### +.....#.##.##... +#######.####.## +.......#.####.. +####..#..#..... +####...##.#.... +#.##.....##.#.. +....#####...#.. +....#.#.###.... +.##.#####.##### +.......##.#.### +#..#####.....## +#####.##.....## + +....#.##. +##..#.... +##...##.# +##......# +..#.#.##. +..#...### +......### +..#.#.##. +##......# +##...##.# +##..#.... +....#.##. +####..... + +.#..##. +#.#.### +#..#... +#...##. +####..# +#..#.## +#..#.## +####..# +....##. +#..#... +#.#.### +.#..##. +##..### +##..### +.#..##. +#.#.### +#..#... + +#..##..#....####. +..####..#.....##. +.#.##.#.####...## +.#....#...#...### +........#...####. +.##...#.##.##..## +#..##..##...#.... +..#..#...##..#... +#..##..#...#####. +.##..##.###..#.#. +.##..##.###..#.#. +#..##..#...#####. +..#..#...##..#... + +#....##.####.## +#...##.######.# +.##.#.##.##.##. +..##...#....#.. +#..#..#........ +#.#..#.######.# +#.##..#.####.#. +###.#.##.##.##. +#..#.#........# +#..#.#........# +###.#.##.##.##. +#.##..#.####.#. +#.#..#.######.# + +###.....###.##. +.....##.#.#..#. +.....##.#.#..#. +###....####.##. +...#...#..##.#. +..##.#...#....# +####.##.#..#... +######.##.#.### +######.#...#.#. +...#.#.####.### +###..##...#..## + +.###.#..####..#.# +.#...#.########## +#...###..##..#.#. +#...###..##..#.#. +.#...#.########## +.###.#..####..#.# +..###...#..###..# +..###...#..####.# +.###.#..####..#.# +.#...#.########## +#...###..##..#.#. + +##..##..# +...#..#.. +#.##..##. +.#..##..# +##..##..# +.#..##..# +#.##..##. +.#..##..# +..##..##. + +..#.##....#.. +#.#....#.#... +....##....... +..######..... +.########.#.. +#..#..#..#### +##......##... +#..#..#..##.. +..######..#.. +.##.##.##..## +..######..... +...#..#...#.. +##..##..##... + +....#..##..#..... +.#.#.#....#.#.#.. +.#.....##.....#.. +...######.###.... +....#.#..#.#..... +#.##..####..##.## +..#..........#... +##....#..#....### +.....#.##.#...... +###...#..#...#### +##.#.#.##.#.#.### +.##.########.##.. +..#....##....#... + +#..##..#.#.##.. +.#.##.#..##.### +###..####.#.### +.#.##.#......#. +.#.##.#......#. +###..####.#.#.# +.#.##.#..##.### +#..##..#.#.##.. +##.##.##.##..#. + +....#..##...### +......###.#.### +.##.###....#.## +....###.#..#.#. +....#.#.#.##.#. +#..##.#..#.##.. +#..##.#..#..#.. + +###.###..#.##.. +..####..###.... +..#..#..##..... +##.....#.....## +###......##...# +..#...#.##.###. +..#.....###..#. +..#.....###..#. +..#...#.##.###. +###......##...# +##.....#.....## +..#..#..#...... +..####..###.... +###.###..#.##.. +#####.......... + +...#..#.... +#...##...## +##..##..### +###.##.#### +...#..#...# +...#..#...# +###.##.#### +##..##..### +#...##...## +...#..#.... +#..#..#..## +#...##...## +#.#....#.#. +#..####..#. +##.#..##### + +.###..#.####.##.# +.#.#.##.##.###### +####.#.##........ +#..#.#.##....##.. +#..#.#.##....##.. +####.#.##........ +.#.#.##.##.###### +.###..#.####.##.# +.#.#..#.##.#....# +...###.#...#.#### +##..#####.##....# +.#.##.#..#.###### +.#.#.####..#....# +....##.##.#.####. +.##.##..##.#....# +....#.#.#.###..## +..##.###.....##.. + +......# +.#....# +#..#.#. +#..#.#. +.#....# +......# +#.###.# + +####...## +.....#### +..#..#..# +##.#.##.# +#.....#.. +##.####.. +..#....#. +#####..## +##.##.... +##...##.# +##.#.#... +##.#.#... +##...##.# + +#.#.#.. +#.#.#.. +###..## +..##.#. +##.#... +.##..#. +###..#. +###..#. +.##..#. +#..#... +..##.#. + +..#.#.##.#.#. +..###.##.###. +..####..####. +..#...##...#. +##.#..##..#.# +##..........# +###.#.##.#.## +..##########. +##..........# +#.##.####.##. +######..##### +..##.####.##. +##..#.##.#..# +#####.##.#### +...#..##..#.. + +#.#....#.#..... +.#.#....#.#.### +##.####.##.#### +....##....##.## +.#..##..#..#... +###....####.#.. +....##.....##.. +#.#.##.#.##..## +##..##..##.##.. +...#..#....##.. +##......###..## + +.#..###..#..### +.#..###..#..### +#.####..##.#..# +###...##.#.#.#. +.##....####.... +..#......##.##. +#.####..#.#.... +#...##..##..#.# +...###...#...## +.#..##.#...#... +.####.#..#..##. +.####.#..#..##. +.#..##.#...#... +...###...#...## +#...##.###..#.# + +######.#..#..#### +##.#...###....... +#..#####.#...##.# +#..#####.#...##.# +##.#...###....... +######.#..#..#### +#...#..###...#.#. +.###.####..#.#.#. +##.#.#...##.###.. +...#...####...#.# +...#...####...#.# +##.#.#...##.###.. +.###.####..#.#.#. +#...#..###...#.#. +######.#..#..##.# + +.#....#...##. +.##..#.#..#.# +#.##..#.##... +##.###.#.##.. +##.###.#.##.. +#.##..#.##... +.##..#.#..#.# +.#....#...##. +..##..###.... +..###...#..#. +#...##..###.. +.#..##.##.##. +.##.##.#...## +.#...#..#.... +.#...#..#.... +.##.##.#..### +.#..##.##.##. + +##......# +...####.. +..#....#. +..#.##.#. +..#.##.#. +..##..##. +##......# +##......# +..#.##.#. +#........ +##.####.# +..#....#. +##.####.# + +....####...## +###..#.##..## +###....##..## +....####...## +#..#.#..##.## +.#.#.#...#.## +##.#..#...... +..#.##.###... +#...#.#####.# +....##..#.... +###...###.### +###...###.### +....##..#.... +#...#.#####.# +..#.##.###... + +.#.##...#.#..## +...####.###.#.. +######.###..#.. +....#...#.#..#. +....#...#.#..#. +######.###..#.. +...####.###.#.. +.#.##...#.#..## +..#.#.###...... +#.#.#.##.#.###. +##....####..### +..##..#..####.. +.....###..#.#.# +##.###.###....# +#.#.#.#.#..#... +#...#.#.#..#... +##.###.###....# + +..##..#.#...#..## +####.####..#####. +####.####..#####. +.###..#.#...#..## +#....##.##.###..# +....#.###.#...#.. +#.##.#....###..## +.#......###..#... +.####.#.#.####### +##.#.#.###.#..#.. +#..#.###..#.###.# +##.......##...#.. +##.......##...#.. +#..#.###..#.###.# +##.#.#.###.#..#.. + +.#.#####......... +.##.#.#.#..####.. +#..#.#..####..### +###.##.#....##... +###...######..### +####.##.####..### +.#.##.#.#.######. +..####.########## +..####.########## +.#.##.#.#.######. +####.##.####..### +###...######..### +.##.##.#....##... +#..#.#..####..### +.##.#.#.#..####.. + +#.#.##.#.###..##. +..##..##..#..#### +#.##..##.#.###..# +##.####.##...#### +###....###..##..# +...#..#...#..#### +#.#.##.#.###..##. +.##.##.##.#..#..# +##..##..###..#..# +#..#..#..##..#..# +..######...###..# +##..##..####.#..# +#..#..#..####.##. +##########.##.... +##..##..###.#..#. + +#....#...#... +.####.#...... +##..###.#..#. +#....###.##.# +..##....#..#. +..##..##.##.# +.####..##..## +......#...... +.#..#..###### + +###..###...#. +..##..##.##.. +##.#.##..#### +##.##..#####. +#.##...#.#.#. +..##...##..#. +...##..##.#.. +##.#.##..###. +##...#....##. +##...#....##. +##.#.##..###. + +#....#.## +#.##.#..# +##..##.#. +.#..#.... +.#..#..#. +##..###.. +##..###.. +.#..#..#. +.#..#.... +##..##.#. +#.##.#..# +#....#..# +##..##### +.####...# +######.#. + +.###..###...##.## +#..#..#..#....#.. +#.#.##.#.#.###.#. +.#.#..#.#.#...### +#...##...#...#..# +###.##.###....### +...#..#...#..#### +##.####.##...#.#. +...#..#...####### +..........#.###.# +.###..###.#.#.#.# +.#..##..#..###.#. +#...##...#....#.# +###.##.####.##### +###.##.####.#.### + +.......##.#.. +.#.##.#..#.## +#####..###.#. +##...###.##.# +....###.#.... +.....###.##.# +...####..#... +..#.#...#...# +###..#.##.#.# +###..#.##.#.# +..#.#...#...# + +...##.. +.#..##. +##...## +####..# +#...#.# +.....#. +..#.##. +####.## +####.## +..#.##. +...#.#. +#...#.# +####..# +##...## +.#..##. +...##.. +...##.. + +.##.#..####.. +##........### +.#..#..#..#.. +#.#.####.#.## +..##.##.##... +.##.#..#.##.. +.#.#.##.#.#.. + +####..##### +....##..... +...####.... +##.######## +###.##.#### +.########.. +..#....#... +..##..##... +###....#### +...#..#.... +..#.##.#... +....##..... +#..####..## + +#..#..##..#.... +...#.##..#..### +..#####...#..## +..#####...#..## +...#.##..#..### +#..#..##..#.... +##.#..#........ +###..#.######.. +##.#.#.##...##. +##..##..#.###.. +#..##....#..... +.#..##..##.#.## +.#.##..#..##... + +.##.##....# +##.##.#...# +.###.#..#.. +###.#.##### +##.#.#.#..# +#.#######.. +#..#..#..## +#.#..####.# +#.#..####.# +#..#..#..## +#########.. +##.#.#.#..# +###.#.##### +.###.#..#.. +##.##.#...# +.##.##....# +.##.##....# + +#.#..#### +###...### +#....#.## +##.###### +#.##.#.## +.####.### +...###... +.#.#..#.. +##.#..### +##.###### +##..##### + +...#..... +...#..#.. +######... +##.#.#.## +###..#... +.#.##.#.. +##....... +.#.#.#### +#..##.### +.###..... +#..###### + +.#..##... +#...####. +.#.#.#### +....#..## +....#..## +.#.#.#### +#...####. +.#..##... +..###.... +##.#..##. +.#####..# +##.....## +.##....## +.##....## +##.....#. + +####.#.## +.##.#.... +#####..## +.....#... +.##....## +#..#.#.## +####..#.. +#..#.##.. +.##.####. + +...#.#.##...##... +##....#.#.######. +##.#.#....#.##.#. +###..##.#.##..##. +###.....######### +..##.#.#...####.. +.#.#.......####.. +###.#.#.#...##... +##.########....## + +###.##.#. +.#.###... +######.#. +.#.#...## +.#.#....# +######.#. +.#.###... +###.##.#. +###.#..## +..######. +#.##...## +..####.## +.#.....#. +.#.....#. +..####.## +#.##...## +..######. + +.#.##.#........ +#####.#...##... +##.#.####.##.## +#####.#.#....#. +#.####...#..#.. +..#.#####.##.## +##.#.#...#..#.. +.#.#.##..#..#.. +.###....#.##.#. +#..#.##.##..##. +#.#.##...#..#.. +###...#..#..#.. +###...#..#..#.. +#.#.##...#..#.. +#..#.##.##..##. +.###....#.##.#. +...#.##..#..#.. + +###.....# +#.#.#.##. +#.##.##.# +...###### +...###### +#.##.#### +#.#.#.##. +###.....# +#.##.##.. +#.##.##.. +###.....# +#.#.#.##. +#.##.#### + +...#....#...#.. +.####...###.#.# +####....######. +#...####...##.# +##.######.###.. +#.#.####.#.##.# +...##..##...##. +..#.####.#....# +####.##.####..# +..............# +.###....###.#.# +#.###..###.##.. +#.###..###.##.. +.###....###.#.# +..............# + +#...#.####.#.#. +.#.##..##..##.# +#....######.... +#.###..##..###. +##.#.#....#.#.# +..#.##.##.##.#. +..#.##.##.##.#. +##.#.#....#.#.# +#.###..##..###. +#....######.... +.#.##..##..##.# + +###.... +...#### +##..... +#...##. +#..#### +###.... +..##### + +......##.#.##.#.# +..#####.##....##. +##.#..#.#.####.#. +..##.####..##..## +####..#.#..##..#. +##.#...#........# +..##...#...##...# +####...#.#.##.#.# +###...##..#..#..# +###.#####..##..## +....###.##....##. +....#..##.#..#..# +..#.##..#......#. +...#.#.....##.... +..#...###..##..## + +###.#########.# +...######..#.#. +...######..#.#. +###.#########.# +..#.....###.### +.##.###.#..#... +....#.#...#.#.# +#####.#...##.#. +#.##.##.##.#### +#.##.##.#..#### +#####.#...##.#. + +####.#.##.# +##.#.##..## +##.#.##..## +###..#.##.# +..####.##.# +##.#...##.. +#.#.####### +#......##.. +.#...#.##.# +.#.##.#..#. +.#....####. +##...##..## +.#..###..## + +##......##.## +#####..##.### +..#..###.#### +####.....#### +####..###...# +##.#.#...#... +#####.##...## +..###.#####.. +##.##.....### + +.###..##..# +.###..##..# +...##...##. +..##.#.#### +##.#.##.#.. +.##...#..## +##.#.#.###. +##..##..##. +##.....##.. +.##...#..#. +..##.###### +..#.##..... +..#.##..... +..##.###### +.###..#..#. + +#.####.#..##..#.. +##....##..#####.. +#..##..##....##.. +.#.##.#..#....### +###..######..#... +##.##.###.##..#.. +..#..#....#...### +.##..##.##.#.#### +.##..##..##.###.. +.#....#.#..#.##.. +#..##..#####.#... +#..##..###.#####. +.#....#.####.##.. +...##...#.#...#.. +.######.####.#... + +##....##.#.## +#..###.#.##.. +.##.......##. +.##...#.#.### +.#.....#.##.. +.###...#..##. +.###...#..##. +.#.....#.##.. +.##...#.#.### +.##.......##. +#..###.#.##.. +##....##.#.## +##....##.#.## +#..#.#.#.##.. +.##.......##. + +##..##...##.#..#. +##..##...##.#..#. +#.##.###.#.##..#. +#....########.##. +........#.###.### +.####..####.#.#.. +#....##.#...#..## +##..###..#..#..## +#.##.#..###.#.... +######.#..##.#.## +#.....####..##..# +..##..##...#.##.. +##..###...#..##.. +######.######.##. +#....######...##. + +.#..#.# +####... +..###.# +..###.# +.###... +.#..#.# +#.##### +..##..# +#.....# +#.#..## +#.#.### +.#.#.#. +..#.### +.....## +#...... +###...# +###...# + +.#######. +########. +###..###. +#......## +###..###. +..#..#..# +.#....#.# +#.####.## +#.####.## +.#....#.# +..#..#..# +###..###. +#......## +###..###. +########. +.#######. +##....##. + +.#..####. +.#..####. +.####.#.# +..###.##. +...####.# +###.....# +.#.###.## +.....##.. +.....##.. +.#.###.## +###.....# +#..####.# +..###.##. + +....#.# +....#.# +.###.#. +.##...# +..##... +#.#..## +#####.# +#####.# +#.#..## +..##... +.##...# +.###... +....#.# + +#......##..#..#.. +.###.##.##.#..#.# +#......#.#..##..# +#.#..#.#..######. +........##.####.# +##....##.##.##.## +#.#..#.#.#..##..# +#.#..#.###..##..# +###..####.######. +..####..#.#....#. +#.#..#.####.##.## +###..######....## +.#.##.#.##.#..#.# +.#....#..#..##..# +#.####.##.#....#. + +#.#...####.#.#### +#.#...##.#.#.#### +.###.#.####..#### +..#.#.#...##.#... +###...######.##.. +#....##.#...#...# +#.#...#..#..##... +#..#.....###..#.. +#.#..#..##.#.#..# +...#..##......### +##....########.## +###.#...#.....### +.#####..##..#..## +.#####..##..#..## +###.#...#.....### +##....########.## +...#..##......### + +#..####..## +.#.####.#.. +.#..##..#.. +#........## +#..####..## +.###.####.. +##.#..#.### +.##.##.##.. +..##..##... +#.##..##.## +#..#..#..## +#.##..##.## +.#......#.. +#..####..## +###.##.#### +..######... +.##....##.. + +.#..##. +.###### +.#.#### +.###### +.#..... +.#.#### +#.##### +..##..# +..#.... +.##.##. +....##. +....##. +.##.##. +..#.... +#.##..# + +...####.### +#..#...#... +###.###.#.# +###.###.#.# +#..#...#... +...#.##.### +...#.##.### +#..#...#... +###.###.#.# + +......####..#..## +......####..#..## +#.##..##..#..#... +.####..#....#.#.# +..##.#..#..###..# +####...#.#.....#. +#.#.#..###..#.... +##.#.####...###.# +.####.#...###.#.# +.##...#.#..###.## +..##..##.##..#.## +#.##.#.#.#....#.. +##.#.####....##.. +##.#.####....###. +#.##.#.#.#....#.. + +#.#..#.#...#..#.. +.....##..###.##.# +##...###.##...... +#.##..#..##.##.## +....####.####.... +####.#.#.##..#... +##.##.#..##.###.. +###.#.#.##...#... +.#....#.#.###.... +#..###.##........ +........#...##### +........#...##### +#..###.##........ +.#....#.#.###.... +###.#.#.##...#... + +#..##..#### +.#.#...#### +#.#..##.##. +#..###.#..# +#.....##### +#.#....#..# +##..#.#.##. +.#..#.#.##. +#.#....#..# +#.....##### +#..###.#..# +#.#..##.##. +.#.#...#### + +.###..### +##.####.# +.#......# +.#......# +##.####.# +.###..### +..#.####. +###.##.## +..######. + +####..#...##. +.##.##.###### +#..##..#.#..# +...##..#.#..# +.##.##.###### +####..#...##. +.##.#.#.#.##. +...#.#.##.##. +#.#....#..##. +....##.#..... +.#.###..##### +.#..####..##. +..###...##..# +...##.####..# +##..####..##. +..##.##..#..# +.#....#...##. + +#.##.###.#### +#.#.##.###.## +###.#####.#.. +#.#....#.#.## +..##.....#.## +##..###...### +#..#..#...#.. +#..#..#...#.. +.#..###...### + +#.##### +.#..... +.#.#..# +.#..##. +.##.... +..#.... +.#..##. + +..##.##.##### +####....##.## +..##.#.....#. +..###..##.#.# +#....##...### +...####...### +...#.##...### +#....##...### +..###..##.#.# +..##.#.....#. +####....##.## +..##.##.##### +..##.##.##### + +##.#### +.#..### +.#..### +##.#### +#..##.. +..#.##. +.##.### +#...#.. +#..#### +###.#.. +##...## +##..#.. +#..##.. + +.####..#####..# +#..#....#..#### +#..######..#..# +#####..######## +...#....#...##. +##..####..##..# +#...#..#...#..# + +.##..##.###...##. +.##..##.###...##. +......##.###.#..# +....##...#...#..# +...#.....##.#..#. +#####.#.......#.# +.##.#.#.#...##.#. + +.#...## +#..#### +#.#.##. +...###. +.##..## +#####.. +..#.... +..#.... +#####.. +.##..## +...###. +#.#.##. +...#### +.#...## +.#...## + +#.##..##.#####..# +.#......#.#.##... +.#......#.#.##... +#.##..##.######.# +.##.##.##.#...#.# +####..####.#####. +...........#.##.. +###....####..#.## +.#......#.###..#. +##......##..##### +#.######.#....##. +.##....##...#..#. +#.##..##.#...#... + +####.#.#.##.# +####...###### +....#........ +#..#.#.#....# +#..#....####. +#..#.####..## +#..#.#..#..#. +#######..##.. +#..#..##....# +######.##..## +.##..#..#.... +####...##..## +.##..#.#....# diff --git a/23/elixir/inputs/day13_example.txt b/23/elixir/inputs/day13_example.txt new file mode 100644 index 0000000..3b6b5cc --- /dev/null +++ b/23/elixir/inputs/day13_example.txt @@ -0,0 +1,15 @@ +#.##..##. +..#.##.#. +##......# +##......# +..#.##.#. +..##..##. +#.#.##.#. + +#...##..# +#....#..# +..##..### +#####.##. +#####.##. +..##..### +#....#..# diff --git a/23/elixir/lib/days/day13.ex b/23/elixir/lib/days/day13.ex new file mode 100644 index 0000000..be03897 --- /dev/null +++ b/23/elixir/lib/days/day13.ex @@ -0,0 +1,56 @@ +defmodule AOC.Day13 do + use AOC.Day, day: 13 + + def parse_input(lines) do + lines + |> Enum.chunk_by(&(&1 == "")) + |> Enum.reject(&(&1 == [""])) + |> Enum.map(fn pattern -> + Enum.map(pattern, &String.to_charlist/1) + end) + end + + def find_horizontal_reflection(pattern, required_differences) do + Enum.find(1..(length(pattern) - 1), fn cut_size -> + {upper_pattern, lower_pattern} = Enum.split(pattern, cut_size) + + upper_pattern = + upper_pattern + |> Enum.reverse() + |> List.flatten() + + lower_pattern = List.flatten(lower_pattern) + + differences = + Enum.zip(upper_pattern, lower_pattern) + |> Enum.count(fn {symbol1, symbol2} -> symbol1 != symbol2 end) + + differences == required_differences + end) + end + + def find_vertical_reflection(pattern, required_differences) do + pattern + |> List.zip() + |> Enum.map(&Tuple.to_list/1) + |> find_horizontal_reflection(required_differences) + end + + def calculate_summary(patterns, required_differences) do + Enum.map(patterns, fn pattern -> + case find_horizontal_reflection(pattern, required_differences) do + nil -> find_vertical_reflection(pattern, required_differences) + x -> 100 * x + end + end) + |> Enum.sum() + end + + def part1(input) do + calculate_summary(input, 0) + end + + def part2(input) do + calculate_summary(input, 1) + end +end