diff options
author | Oscar Najera <hi@oscarnajera.com> | 2023-12-16 08:12:14 +0100 |
---|---|---|
committer | Oscar Najera <hi@oscarnajera.com> | 2023-12-16 08:17:33 +0100 |
commit | 10c9cf1cb8f65970fe9022f83b81979781fbc61c (patch) | |
tree | 23fbb78362425c1d75879ed86e365a3474eb713e /AoC2023/day13 | |
parent | 435987a86bfe924f0e9e504074aa8637a8b02b1c (diff) | |
download | scratch-10c9cf1cb8f65970fe9022f83b81979781fbc61c.tar.gz scratch-10c9cf1cb8f65970fe9022f83b81979781fbc61c.tar.bz2 scratch-10c9cf1cb8f65970fe9022f83b81979781fbc61c.zip |
day13
Diffstat (limited to 'AoC2023/day13')
-rw-r--r-- | AoC2023/day13/eg-in | 15 | ||||
-rw-r--r-- | AoC2023/day13/input | 1407 | ||||
-rw-r--r-- | AoC2023/day13/solver.lisp | 85 |
3 files changed, 1507 insertions, 0 deletions
diff --git a/AoC2023/day13/eg-in b/AoC2023/day13/eg-in new file mode 100644 index 0000000..3b6b5cc --- /dev/null +++ b/AoC2023/day13/eg-in @@ -0,0 +1,15 @@ +#.##..##. +..#.##.#. +##......# +##......# +..#.##.#. +..##..##. +#.#.##.#. + +#...##..# +#....#..# +..##..### +#####.##. +#####.##. +..##..### +#....#..# diff --git a/AoC2023/day13/input b/AoC2023/day13/input new file mode 100644 index 0000000..94d7070 --- /dev/null +++ b/AoC2023/day13/input @@ -0,0 +1,1407 @@ +#.##....##.#. +#.##....##.#. +.#.#....#.#.# +.###....###.. +#.#.####.#.#. +.####...###.# +#..######..#. +..#..##..#..# +.#........#.# + +###......#### +..##....##... +.#.######.#.. +#.###..###.## +#.##.....#.## +.#.##..##.#.. +.##......##.. + +...#.#.##.#.#.... +..###..##..###... +#..##.#..#.##..## +#.###.####.###.#. +####..#..#..####. +####.##..##.##### +#..#.##..##.#..#. +..####.#######..# +......####......# +...#........#...# +...#........#...# + +#..###..### +#..#.#..#.# +..###.##.## +....#....#. +.....####.. +###.#.##.#. +#.#####.### +##.###..### +#...#....#. +#..#.####.# +#..#.####.# + +##..######..# +###.##..##.## +###..####..## +...#.#..#.#.. +..##.#..#.##. +###.#.##.#.## +##....##....# +####.####.### +...########.. +..#.#....#.#. +###..####..## +..##......##. +###.#.##.#.## +####..##..### +#..#......#.. +...##.##.##.. +###.##..##.## + +####....#...# +###.....#...# +.###.#.###.## +##.#...##.#.# +#.##.#.#.###. +#.#.#..##..#. +##..##..#...# +###...###.#.. +###...###.#.. +##..##..#...# +#.#.#..##..#. + +.####..####..#### +.#.######.#..#.## +##...##...####... +#.#.#..#.#.##.#.# +..#.####.#....#.# +#.#.####.#.##.#.# +.##..##..##..##.. +##..#..#..####..# +...#.##.#......#. +##.#....#.####.#. +..###..###....### +.##########..#### +..###..###....### +#.#.#..#.#.##.#.# +#....##....##.... +.#...###..#..#..# +#..#....#..##..#. + +.##..#..#........ +.##..##.......#.# +#########.###.... +..#..#..#....#.## +..#..#........#.# +#......##..###... +.######.#....#### +#......###.###### +..#..#..#..##.... +..#..#..#..##.... +#......###.###### +.######.#....#### +#......##..###... +..#..#........#.# +..#..#..#....#.## +#########.###.... +.##..##.......#.# + +..####. +.##..## +##.##.# +##.##.# +.##..## +..####. +.###### +#...... +###...# + +##..##. +##...#. +##.#..# +##...#. +..#..#. +.#..#.# +.#...#. +.###.#. +.###.#. + +#..####..######.. +..##..##..####..# +..#....#...##...# +..#.##.#..#..#..# +.#.####.#..##..#. +.##....##..##..## +..........#..#... +..#....#.#.##.#.# +.##....##.####.## +.########......## +##.#..#.##....##. + +.##.#..#.##.#.... +#..#......###.#.. +#..###.###.##.... +.##.#...#....#... +.##...###...###.. +#..####....##.#.. +.##.####.######## +#####.####.##..## +#..####.#####.### +###..###.#.##.### +.##....#.#.#...## +.......#.#.....## +#..#...#..##.#### +.##.#..##.#.##.## +#..#.#.##.#.#.... +#######.##..#.### +#####.##....#.### + +..#..#..#.. +#......#..# +.######.#.. +#..##..#.#. +#..##..#.#. +.######.#.. +#......#..# +..#..#..#.. +..#..#....# +##....##### +##.##.#.#.# +#.####.#..# +..#..#..##. +..####..... +...##...### + +.####.#.##.#. +#....###..### +#.##.#.#..#.# +......#....#. +.#..#.#...... +.####.#.##.#. +......##..##. +.......#..#.. +.#..#..####.. + +...##.#.##..# +#.#..######.# +#...##..###.. +##...#.....## +..#...#.##.## +..#...#.##.## +##...#.....## +#...##..###.. +#.#..######.# +...##.#.##..# +#..#..#.#.... +#..#..#.#.... +...##.####..# + +#.#...#.##.#..# +##..##.####.##. +.#######..##### +#.#.##..##..##. +.#.##.##..##.## +#.#.#..#..#..#. +.....#.#..#.#.. +..#..##.##.##.. +..#..##.##.##.. + +.#..##.#..#.. +#..#.####.##. +###.#.##.#.## +###.#.##.#.## +#..#.####.##. +.#..##.#..#.. +.#...#.#.###. +##...##..##.# +.#...#.....## +.###..#..##.# +.###..#..##.# +.#...#.....## +##...##..##.# +.#...#.#.###. +.#..##.#..#.. +#..#.####.##. +###.#.##...## + +##..#..##.##.###. +#....#.#.##...#.# +#....#.#.##...#.# +##..#..##.##.###. +.##....##....#..# +.##..#..#.###.... +..###...######.## +#.##.###..#..#### +....#.#.###.###.. +.##....#####.###. +..##.##..##.#..## +..##.##....#..... +..##.##....##.... + +###.###..###. +###.###..###. +.#...#.##.#.. +.#.#..####..# +.#...##..###. +#.########### +#####......## + +##..#.##. +##..#.##. +###.##### +.#.#..##. +####..##. +#....#### +.######## +..#.##..# +.#.####.# +#.###.... +.##.#.##. +###.##### +#####.... + +#.#..## +...#.## +..#..#. +...#.## +###.##. +#.....# +##....# +#####.. +#####.. +##....# +#.....# + +.##....##.. +..#..#.##.# +..#.##.##.# +.##....##.. +.....#....# +#..#...##.. +..#..##..## +.###..#..#. +##.##...... +#.##..#..#. +...#....... +.##........ +.##..###### + +#.####.#.##.####. +#......##.#.#..#. +...##.....##....# +#.####.###.#.##.# +#.#..#.#.##..##.. +.##..##.###.###.. +...##.....#..##.. +.#.##.#.##....... +#.####.#..#...... + +..##..#..#.#... +..#####....#### +...##..##.#..## +...##..##.#..## +..#####....#### +..##..#..#.#... +#..#....##..... +#.##.##.##...## +..##.......#.## +.#.##.#...##### +##....###.##..# +#.####.###...## +.#...##.##..... +###.#.#.#.##... +##....#....#### +....#.##..##.## +#...######.#### + +#..#.##.#..#..# +#..#.##.#..#.## +..########...#. +.####..####.... +##.##..##.##.#. +#..........###. +#####..######.. +....####......# +#.#..##..#.##.. +.#.#.##.#.#.#.# +..###..###..##. +#.###..###.###. +###.####.####.. +##.#.##.#.####. +####.##.#####.. + +#.#..#.#.#.#..### +#.####.###.#.##.# +..####...##..#..# +##....##.#.###.## +..............#.. +.#....#...#..###. +#.#..#.#######... +#.#..#.#.....#... +.#....#...######. +########.....###. +.##..##.#.#.....# +##....##..#..##.# +.#.##.#...#..##.# +.#....#..##...#.. +#.#..#.#.#.#.#..# +#.#..#.##.##.###. +#.#..#.##.##..##. + +#.#....##....#.## +#.#####..#####.## +#.....####.....## +.#.#.#....#.#.#.. +...#.#.##.#.#.... +.##.#......#.##.. +#.#...#..#...#.## +###.########.#### +.#.#..#..#..#.### +.#.###.##.###.#.. +###..#.##.#..#### +#.#.##.##.##.#.## +#.#..........#.## +.###.#....#.###.. +####.#.##.#.##### +#.#.#.####.#.#.## +.#.###.##.###.#.. + +......#.. +#.#.#..## +..#..#..# +..#..#..# +#.#.#..## +......#.. +##.....#. +#.#.#.#.. +##.#.#.## +....###.# +#..###.## +#..###.## +...####.# +##.#.#.## +#.#.#.#.. + +..##..##..#.# +###.##.#..#.. +##.######.### +##....#.#.##. +##....#.#.##. +##.######.### +###.##.#..#.. +..##..##..#.# +#...#...##... +#...#...##... +..##.###..#.# + +#.###.##..#..##.# +##.##....#....##. +##.##....##...##. +#.###.##..#..##.# +#.#..#.#.#..#.### +#...#.###..#...## +.####..#.#.#..... +..#####...#####.# +....####..#....#. +.#.###..##.###.## +.#.###..##.###.## +....####..#....#. +..#####...#####.# +.####..#.#.#..... +#...#.###..#...## + +..##.##...# +##########. +.#.##..#..# +..##..##.## +......#.#.# +......####. +###.#####.. +###.#####.. +......####. + +##...#.#..#.#.. +##.#.#..#.##.## +#.####.##..#.## +#.#######..#.## +##.#.#..#.##.## +##...#.#..#.#.. +.#.#.###...##.. +...##..###.##.. +.#.######...### +..##.#..#.##.## +###..#...##.### +######.#.#.#### +#..#..####.#### + +#......###.#..#.# +.##..##.##..##..# +########....##... +.........#..##..# +###..####..#..#.. +##.##.##..##..##. +..#..#..##.#..#.# +###..####...##... +.#....###.##..##. +#......#.#......# +##.##.###........ +...##.....#....#. +#.####.###.####.# + +###..#.#.#... +#.#...#.#..## +..##......#.. +..#.##..##..# +.##.##.##.#.. +.#.###.###..# +.#.###.###..# +.##.#####.#.. +..#.##..##..# +..##......#.. +#.#...#.#..## +###..#.#.#... +#####...#.... +.###.####.##. +.###.####.##. + +#..##.#..#. +...##..##.. +...##..##.. +#...#.#..#. +.##.#.#..#. +.##.#.####. +#.#..#.##.# +#...#.####. +..######### + +.....#.####.#.. +.##.###.#..###. +....#.######.#. +....#..#..#..#. +.##.#........#. +#..#..##..##..# +####..........# +####.########.# +.##.####..####. +#..#..##..##..# +#..###.#..#.### +#..###.#..#.### +.##..#.####.#.. +#..###.#..#.### +#..#.########.# + +....#....#..# +.#.##.##.#.#. +###.###.#...# +###.###.#...# +.#.##.##.#.#. +....#....#..# +..###..###.#. +..#.#.###..#. +####..###.##. +####..###.##. +..#.#.###..#. +..###..#.#.#. +....#....#..# +.#.##.##.#.#. +###.###.#...# + +..######.#..#.# +.###..#.#..#.## +.###..#....#.## +##.###..#.#..## +......###.#.### +##..##....##... +##.###.##.#.##. +####..##..#.#.. +####..##..#.#.. +##.###.##.#.##. +##..##....##... +......###.#.### +##.###..#.#..## +.###..#....#.## +.###..#.#..#.## + +..#.#...##..# +.##.#...##..# +..#.#######.# +##.#.####..## +.#.#.#...##.. +##....#..##.# +.#......##.## +..##.##..##.# +.....#####.## +###.....####. +##.#..#....## +##.#..#....## +###.....####. + +...#.##....##.# +###.#.#.##...#. +###.#.#.##...#. +...#.##....##.# +...#.###.#.###. +#..##..##.....# +##.#....##.###. +###..#######.## +##..#..#....##. +##..##.###..### +..#..#.....#... +.#####.#..###.. +####.#......#.# +####.#......#.# +.#####.#..###.. +.##..#.....#... +##..##.###..### + +##.#..##.#.##.#.# +#.##.#.####..#### +.##.......####... +.#########....### +.#....#####..#### +.#....#..#.##.#.. +.##...#..##..##.. +##.#.....#....#.. +##.###...######.. + +#.##.#..### +##..###..## +.#..#.#.### +.......#### +.####.##### +.####....## +#.##.##.##. +......#.#.. +..##..##.## + +#.......# +#.......# +##....### +..#.#..## +#..####.. +...##..#. +###.#.##. +..###..#. +.....#.## +###.#.#.. +.##.##... +#.##.##.. +#.##.##.. +.##.##... +###.#.#.. +.....#.## +...##..#. + +.#.#.###.#..# +.##....###### +.##.#.#.##### +.##.#.#.##### +.##....###### +.#.#.###.#..# +#.#.#.####..# +#.#...#...##. +#..#.###..... +..#.#.#.##..# +.######..###. +#...#.#.##### +.#..#.##..... +..###.#.##### +#.#######.... + +###...###.#####.# +#....#.##..##.#.. +.#.#.#.#.#....... +###...#.....##### +.##...#.....##### +###.#.....#...##. +###.#.....#...##. +.##...#.....##### +###...#.....##### + +..#..#..### +##.##.###.. +#.####.#### +#########.. +###..###### +..####..... +#..##..#.## +..#..#..... +..#..#..... +.#....#.#.. +...##..#### +########... +########.## + +.#..#.##.####.# +######.######## +.#..#.......... +.#..#....####.# +.#..#..###..### +......#...##... +.#..#.######### +.#..#...######. +######......... + +..##...#. +####.###. +#.##.#.#. +....#.... +....#.... +#.#..#.#. +####.###. +..##...#. +#.##....# +...##.#.. +.###..... +.###..... +...##.#.. +#.##....# +..##...#. + +##....###.#.#.# +#.####.#.#..#.. +.#....#..###..# +..####..###...# +..####...##.#.. +##....###.#...# +.#.##.#.#.##.## +.#.##.#.#..#### +.........#.#..# +#.#..#.#..#.#.# +.######...##.## +.######...##.## +#.#..#.#..#.### + +#..#....#..#....# +#..#.#..#####.#.# +.##...###..##.### +####.#.#.#.#..### +####.#.#.#..#..#. +#..##..#.###.#... +#..#.#.###..##... +.##.....###.....# +.##...#..##.#.#.. +.##...#..##.#.#.. +.##.....###....## + +#.##.##...#.### +####.##.#.##.#. +...######.#..## +..#..#.....##.. +.####.#.####.#. +#.####....##.#. +.####.#.##.##.# +#.#...#.#.#.... +#.#...#.#.#.... +.######.##.##.# +#.####....##.#. +#.####....##.#. +.######.##.##.# +#.#...#.#.#.... +#.#...#.#.#.... +.####.#.##.##.# +#.####....##.#. + +#...#..##.#.##..# +#..#.#...###.#..# +#..#.#.#.###.#..# +#...#..##.#.##..# +#...#.......##..# +.#..#.#.#.###.##. +..###....#....... + +.####...##..# +.####....#..# +####.#...#### +...#.#......# +#.....##.#.## +#...#..#.##.. +#...#..#.##.. + +.#..########..# +#.###.#..#.###. +...#.#.##.#.#.. +#.############. +.#####....##### +.......##...... +#....#....#.... +...##.#..#.##.. +#.####....####. +##..##.##.##..# +##..##.##.##..# +..####....####. +...##.#..#.##.. +#....#....#.... +.......##...... +.#####....##### +#.############. + +......##. +.#..##..# +..##.##.. +###.##..# +#....#### +#.##.##.# +#.##.##.# +#....#### +###..#..# +###..#..# +#....#### +#.##.##.# +#.##.##.# +#....#### +###.##..# + +.#.###.###..### +....#.#..#..#.. +...#..#.#....#. +#....####....## +.#....##......# +##.#.#.##....## +#.#..########## +#.##.#.#.####.# +#.##.#.#.####.# +#.#..########## +.#.#.#.##....## +.#....##......# +#....####....## + +###.####. +##...#.#. +..###.### +##..###.. +##..###.. +..###.### +##...#.## + +.#....#.#..## +#.####.####.# +###..####.### +###..####.### +#.####.####.# +.#....#.#..## +#.####.##.... +.........###. +##.##.##....# +#.#..#.#...## +.#.##....#.## +###..###..#.# +.#.##.#..#..# +.#....#.#.... +#......##..## +..####...#.## +.#.##.#.##..# + +.###.###.#. +#.#..###..# +...###.#..# +...##.###.. +...##.##... +...###.#..# +#.#..###..# +.###.###.#. +###..##.... +###..##.... +.###.###.#. +#.#..###..# +...###.#..# + +.#..... +###.#.. +#.....# +##.###. +.#....# +.#....# +##.###. +#.....# +.##.#.. +.##.#.. +#.....# +##.###. +.#....# +.#....# +##.###. +#.....# +###.#.. + +##...#..#...# +..##..##..##. +...#.#..#.#.. +##.#.#..#.#.# +##..#####...# +###..####..## +..#...##...#. +....#....#... +....#....#... +###...##...## +###........## + +#...##...##..## +.#......#.#.... +..#....#...##.. +####..######.## +###....###..#.. +#.##..##.###### +#........###... +##......##.##.. +.########....## +..........###.. +..#...##.....## +..##..##..#.### +..#....#....### + +..#.####.#..# +..#.####.#..# +...#....#.... +##........##. +#.#.####.#.#. +#.#.#..#.#.#. +#.##....##.#. +#.#.####.#.#. +..########..# +.####.#####.# +.##.#..#.##.. + +#.#....#.#### +..####.##.... +..#...####### +..#....###### +..####.##.... +#.#....#.#### +#...###.#.... +#.##.##..#### +#..#..#...... +.#..##...#..# +######.#..##. +##..##..#.... +#..###.#..... +...###.#.#### +#.#..#.##.... +##..##.##.##. +.##.#.#..#### + +.###... +...#... +...#... +.###... +...##.. +##..#.. +#.#.### +....#.. +##.#... +....#.. +...#.#. +.##.#.. +##..#.. +###.### +####... + +######...#..##. +##..#######..#. +.######.#####.# +#.##.###..##..# +##..##.###.#..# +.#..#.###...### +#....##.....#.. +.........##.### +..##..###..#... +........#####.. +..##..#...#.##. +......#.####... +..........###.# +.......##.##### +##..##.######## +##..##..###...# +##..##..###...# + +.##..#.#..#.#.. +.##.##..##..##. +....###....###. +.##.#.#....#.#. +.#..#..####..#. +#####.##..##.## +....#.#.##.#.#. +.##...#.##.#... +#..#..#....#..# +#####.##..##.## +.......#..#.... + +#.####... +###.###.. +....#..## +##....... +##..#.... +##..#.#.. +###.#...# +.##....## +..##..... +#........ +#..##.... +#..##.... +#........ + +#.##..###...##. +...##..#.###..# +#.#.##...#..##. +.##...##....##. +#..#....#..#### +#..#....#..#### +.##...##....##. +#.#.##...#..##. +.#.##..#.###..# +#.##..###...##. +##.....###..##. + +.##.###..###. +.##.###..###. +...##.#...#.. +.##...##..### +######...#.#. +.##..##.#.### +.##.##..#.... +####.#.#.#... +.....#...##.. +.##.####..#.. +.##.....#...# +.......#.###. +#####..#..##. +########.##.# +.##....#..#.# +.......##.#.. +#..#.###..### + +###.#.###.# +###.###..#. +#..###.##.# +#....##.#.. +#....##.#.. +#..######.# +###.###..#. +###.#.###.# +#..######## +##.#.###### +....#..#.## +.#.##...### +######.#.#. +..##.###..# +..##.###..# +######.#.#. +.#.##...### + +......#.# +.##.#.... +....#..## +....#.#.. +#..###... +#..###... +....###.. +....#..## +.##.#.... +......#.# +#..##..## + +...#.##.#..#.##.# +.#...##..##..##.. +###.####.##.####. +..###..##..##..## +..##.....##.....# +..#.#..#....#..#. +.###.##.####.##.# +.##......##...... +.################ +..#.............. +.#...##......##.. +##..####.##.####. +#..##..######..## +..##....####....# +#................ + +#...#.####### +#..###....... +###.##..#..#. +.#..######### +..##.##.####. +#...##....... +.#.#..##.##.# +#######.#..#. +#.#......##.# +#.####.#....# +....###.#..#. +##.#.###....# +..#....###### +.#..#..#.##.# +.#..#..#.##.# + +###...#.. +#.####.#. +#.####.#. +###...#.. +#..#..#.# +.##.##... +.##..#... + +#..#....#..##.. +#.#.####.#.##.# +.####..####..## +..##..#.##....# +..########....# +..########....# +#.#..##..#.##.# +.##......##..## +##........####. + +####.#.#.###. +##.####....## +...#.#...##.. +...#.#...##.. +##.####....## +####.#.#.###. +..#..###.#### +..#.#....#.## +##.#.#.##..#. +...#...#....# +.##..#.#...## +....###..#.## +##...#.#.#### + +###....#### +.#.#..#.#.. +##.#..#.### +.##.##.##.. +###.##.#### +..##..##... +#...##...## +...#..#.... +...####.... +##......### +.##.##.##.. +#.##..##### +..#....#... + +#.#.#.##..##. +#.#.#.##..##. +#####.#.##.#. +#..#...#..### +##.....#.##.. +##.##.#..#.#. +.#.#...###.## +....####....# +#.....###.... +#....#.#...#. +#....#..##.#. +.###.#.###... +##.###...#### +##.###...#### +.###.#.###... +#....#..##.#. +#......#...#. + +#.##.#.###. +.####.#.... +.####.#.... +#.##.#.#.#. +######..#.. +#.##.##...# +#....#..#.. +.#..#..##.. +..##..##.## +......####. +.#..#.#..#. + +##.#..##..#.### +.#..........#.. +.#...#..#...#.. +...##....##.#.. +###........#### +#..##....##..## +##...#..#...### + +##...#.##.##.## +##.#..##..##..# +#.#..#.#......# +#.#...##....#.# +.#...###.#..#.# +.##.####..##..# +###..##.#....#. +#.#.#.....##... +.....#....##... +....#.###....## +....#.###....## + +###.#.###.. +....#.###.. +....###.... +##.##.#.### +##..####.## +####.##.### +##..###.... +###..#...## +......###.. +.....###... +..##..#.#.. +##...###.## +...#......# +##.####.### +..##..###.. +..##.##.### +........#.. + +#.###.....##### +#.###.....##### +....#..#.##.#.. +##..#.##.#..... +#..#...#....##. +#...####.#.#.## +.#..#.#.###..#. +##.#.#.#....##. +.###...####.#.# +.###...####.#.# +##.#.#.#....##. +.#..#.#.###..#. +#...####.#.#.## +#..#...#....### +##..#.##.#..... + +#..##..###. +.######.##. +########.## +.##..##..## +#########.. +#..##..###. +#..##..#... +#..##..##.. +.##..##.#.# +.##..##.#.. +........### +#..##..#..# +.##..##.#.# + +....#..###.##.# +.#..#..###....# +.#..#..###....# +....#..###.##.# +#..###.##...... +#..##......###. +.#.##.#.##....# +.##.#.#####..## +.#.#.#..###..## +.#..##.###.##.# +.#...#.##...... + +..#.### +###..## +#.#.#.. +####... +.#.#.## +#.##.## +###.#.. +.#.#### +##...## +##...## +.##.... +.##.... +##...## +##...## +.#.#.## +###.#.. +#.##.## + +.....##.. +..####### +##.###### +##...##.. +..####### +.#....... +#..#....# + +...#..#.... +##.####.##. +#...##...## +.#......#.. +##..##...#. +...####...# +..#....#... +####..##### +###.##.###. +#...##...## +##......##. +##......##. +#...##...## +###.##.###. +####..##### +..#....#... +...####...# + +..##.#### +.#.#.#... +.#.#.##.. +####.#.#. +##.####.. +.##.##..# +.#...#... +.####.##. +.##.#.##. +.##.#.##. +.####.##. + +###.### +...#..# +##...## +..#..## +...#### +##..##. +##..##. +...#### +..#..#. +##...## +...#..# +###.### +..#.... +##..... +###..#. + +....#...#.#.. +.##..#..##..# +....#.#...... +######..#.### +.##.##..#..#. +####.##..#### +.##..##..###. +#..#..###.... +####.....##.. +#..###..#..## +#..###.....## +####.....##.. +#..#..###.... +.##..##..###. +####.##..#### +.##.##..#..#. +######..#.### + +..#.###.###.. +###...##...#. +....#.##..... +....#.##..... +###...##...#. +..#.###.###.. +...######.##. +#...###.#...# +...#.###..#.. +##.###.##.##. +..####.#..... +...#.####.#.. +####.#..##... +....#..#..... +..#.#.#.#..#. + +#..#.##..###.#. +.#.####.#.#..## +..#.##.#..##..# +..##..##..#.... +#...##...##.#.. +.########.....# +###....#####... +##..##..##..... +.#.#..#.#.#..## +##......##.#### +...#..#...#.... +.#.####.#..###. +.#.####.#..###. + +#.#.#....#..#..## +...##..##.....##. +....#..##.....##. +#.#.#....#..#..## +.##..#.#..#.....# +..#.#.#..###...## +####..#.###....## +.##.###.###.#.##. +..##.####......## +#..###.##...#..#. +###..#.#####.###. +#..#.##...#####.. +.#.#...#.#.##...# +.#.#...#.#.##...# +#..#.##...#####.. + +.....#..#.. +.#..#.##.#. +###........ +###..#..#.. +.###......# +.#.###..### +..#.######. +..##......# +.#......... +..######### +##.#.#..#.# +##.#......# +.#.######## +....#.##.#. +..#.######. +#...######. +##..######. + +#.##.#.#.#..##### +...#.##.#..#..... +#..#..####....... +#.###.#..#...#### +.###....#.####### +#..##.##.#....... +.###...###.##.... +#...##.##..###### +#....######..#..# +###.##.###.###### +#.########..#.... +.##..##....###### +...#.###..##..... +.#.#####.#....... +..#..##..#...#### + +..##..#.#.. +#.##.##..## +.#..#.#.### +..##....#.. +#.##.###### +#....###.## +##..##.#.## +..##..#.... +######.#... +.####.#..## +.####...#.. +..##..##.## +.####.##... +#######.### +.####.#.#.. +..##..#..## +.#..###..## + +..##.#...##.. +#.####..#..#. +...#..#####.. +..##.##..#... +..##.##...... +##....#.#.##. +.##.#..#.#.## +##..######.#. +#...#..#.#.## +#...#.#...#.# +#...#.#...#.# +#...#..#.#.## +##..######.#. +.##.#..#.#.## +##....#.#.##. +..##.##...... +..##.##..#... + +#.##.#.##.#.# +.#..#......#. +.####.####.## +.#..#..##..#. +##..########. +.#..#.####.#. +.####.#..#.## +######.##.### +##..##....##. +.........#... +.#..#..##..#. diff --git a/AoC2023/day13/solver.lisp b/AoC2023/day13/solver.lisp new file mode 100644 index 0000000..f149f2e --- /dev/null +++ b/AoC2023/day13/solver.lisp @@ -0,0 +1,85 @@ +(ql:quickload '(fiveam)) + +(defparameter eg-vert "#...##..# +#....#..# +..##..### +#####.##. +#####.##. +..##..### +#....#..#") + +(defparameter eg-horizontal "#.##..##. +..#.##.#. +##......# +##......# +..#.##.#. +..##..##. +#.#.##.#.") + +(defun find-repeat (rows) + (loop for (one two-or-nil) on rows by #'cdr + for idx from 0 + when (and (not (null two-or-nil)) + (equal one two-or-nil)) + collect (1+ idx))) + +(defun find-v-mirror (rows) + (remove-if-not (lambda (n) (v-mirror-p rows n)) + (find-repeat rows))) + +(defun v-mirror-p (rows idx) + (every #'equal + (reverse (subseq rows 0 idx)) + (subseq rows idx))) + + +(defun find-h-mirror (rows) + (find-v-mirror + (transpose-rows rows))) + +(defun transpose-rows (rows) + (arrows:-<> + rows + (mapcar #'string-to-octets <>) + (apply #'map 'list (lambda (&rest vals) + (coerce (mapcar #'code-char vals) 'string)) <>))) + +(fiveam:test partials + (fiveam:is + (equal '(4) + (find-repeat + (cl-ppcre:split "\\n" eg-vert))))(fiveam:is + (equal '(4) + (find-v-mirror + (cl-ppcre:split "\\n" eg-vert)))) + + (fiveam:is + (equal '(3) + (find-repeat + (cl-ppcre:split "\\n" eg-horizontal)))) + (fiveam:is + (null (find-v-mirror + (cl-ppcre:split "\\n" eg-horizontal)))) + (fiveam:is + (equal '(5) + (find-h-mirror + (cl-ppcre:split "\\n" eg-horizontal))))) + +(defun solver (maps) + (let ((verical-mirrors (delete nil (mapcan #'find-v-mirror maps))) + (horizontal-mirrors (delete nil (mapcan #'find-h-mirror maps)))) + (+ + (* 100 (apply #'+ verical-mirrors)) + (apply #'+ horizontal-mirrors)))) + +(defun parse-input (file) + (arrows:->> + (uiop:read-file-string file) + (cl-ppcre:split "\\n\\n") + (mapcar (lambda (map) (cl-ppcre:split "\\n" map))))) + +(fiveam:test solutions + (fiveam:is (= 405 (solver (parse-input "eg-in")))) + (fiveam:is (= 35360 (solver (parse-input "input"))))) + +(fiveam:run!) |