From 918d64f25874c9274f449f68f6746b07533615c2 Mon Sep 17 00:00:00 2001 From: Andrew Ekstedt Date: Wed, 13 Dec 2023 05:44:49 +0000 Subject: [PATCH] day 13 part 1 --- day13/input | 1379 ++++++++++++++++++++++++++++++++++++++++++++++ day13/sample1.in | 15 + day13/sol.tcl | 58 ++ 3 files changed, 1452 insertions(+) create mode 100644 day13/input create mode 100644 day13/sample1.in create mode 100755 day13/sol.tcl diff --git a/day13/input b/day13/input new file mode 100644 index 0000000..b749a85 --- /dev/null +++ b/day13/input @@ -0,0 +1,1379 @@ +##..#..#......# +.........#..#.. +.####.#.######. +#....#.###..### +..##..#.#.##.#. +######...#..#.. +#.##.#.#.#..#.# +#....#..######. +.#..#...#.##.#. +#....#....##... +.#..#.#..####.. +......#.######. +##..##.#.####.# + +.#...##.. +..##.#.## +.#.###... +###..#.## +##.#.#### +..#.#..## +.###...## +.#...#.## +#####.#.. +...#..### +###.##.## +####...## +####..### +###.##.## +...#..### + +#####...####.#. +##..###..#..#.# +...#.###.....#. +...#.###.....#. +##..###..#..#.# +#####...####.#. +##....####..... +#..##.....#..#. +#..##.....#..#. +##....####..... +#####...######. +##..###..#..#.# +...#.###.....#. + +#..##...# +#..#..### +#..#..### +#..##...# +.##..#.#. +.....###. +#..#.##.# +...#..### +.##.#..## +.##.#.#.# +#####.#.. + +######.#.#.#... +.#..#.#.##...#. +...#....#.#.#.. +#.##.#.#.....#. +.......##.#.### +#######.##.#..# +......##...##.. +#.##.#....#.#.. +#.##.#....#.#.. + +#...#..##.. +.##..###### +....###..## +.#..#..##.. +.####.####. +###.##....# +.#..##...## +###.#..##.. +#.#.#...... +.####...... +....#.####. +..##..#..#. +..#.#.####. +..#.#.####. +..##..#..#. + +#...#.#.##.#.#... +###.#..#..#..#.## +#...##.####.##... +#.....#.##.#..... +...#####..#####.. +##..#.######.#..# +###.##.#..#.##.## +...#..#.##.#..#.. +....#........#... +#..##.#.##.#.##.. +#................ + +...##.###.# +...##.###.# +##..#....#. +##.....#.## +#.##..#.#.# +..##...#.#. +...#####..# + +.##.##.#.##.. +#..#.#.#..... +####.###..#.# +####.####.### +#..#.#####.## +#..#.#....### +#..#.#....### +#..#.#####.## +####.####.### +####..##..#.# +#..#.#.#..... +.##.##.#.##.. +.....##.#.#.. +####..#.#.##. +#####.#...### +#####.#...#.. +#..#...####.# + +#..#.#...#...##.. +...#...#..#..##.. +#..####.#.#.####. +..#####..#.##..## +..#...####.##...# +.#.#########....# +.#.#########....# + +#..#...#.#.#...#. +#.####...###.#.#. +#.....##...##.#.# +##.##....#....#.. +#.....##....#.... +..##.##.#...#..#. +..##.##.#...#..#. +#.....##....#.... +##.##....#....#.. +#.....##...##.#.# +#.####...###.#.#. +#..#...#.###...#. +......#.#..##.... +......#.#..##.... +#..#...#.###...#. +#.####...###.#.#. +#.....##...##.#.# + +....#.. +#.##... +#.###.. +#...##. +.##..## +.##..## +#...##. +#.###.. +#.##... + +##.##.#.. +..#..#..# +...#####. +..#....## +##.##.##. +##.##.##. +..#...### +...#####. +..#..#..# + +...####.....##### +.#......#.####..# +.#########.##.... +####..#####.##### +..######..#...##. +#.##..##.#....##. +....##....##..... +#........#.#..... +....##.....#..... +...#..#.......##. +#.######.##...... +.##....##.###.##. +...####...#..#..# + +.#...###..###...# +##..##.#....##..# +.#.#.########.#.# +.######.##.###### +.##.#...##...#.## +.#...########...# +.#.#...#..#...#.# +#..#....##....#.. +#..####.##.####.. +#.##..##..##..##. +..#...#.##.#...#. +#..#..........#.. +#..#..........#.. + +....#..###....# +#..#..#..#....# +#..##.....####. +.##..#..#..##.. +####.###..####. +###.#.##.#.##.# +.##..#..##....# +#####.###..##.. +####..#...#..#. +#..#....#..##.. +#..####..##..## +......#.##.##.# +.##...######### +.........#.##.# +.##..######..## +#..####..#....# +.##.####..#..#. + +#..#.##...#.##. +###.##.##.#...# +##.########.#.# +.#.#.##.#...### +.#.#....####... +.#.#....####... +.#.#.##.#...### +##.########.#.# +###.#..##.#...# +#..#.##...#.##. +#..#.##...#.##. + +.##..####..##.. +####..##..##### +.#.#.####.#.#.. +..##..##..##... +#....#####...## +####.#..#.##### +##..........### +#.#.#....#.#.## +#...##..##...## +.##.##..##.##.. +..##..##..##... +....#.##.#..... +###.######.#### + +########..#.##.#. +######..######.## +#.##.#.#.###.###. +#....#.#.####.### +#....##..#..###.. +......##.##..###. +..##..#..#.###..# +..##..#.#.##...#. +##..######..##..# +##..######...#..# +..##..#.#.##...#. +..##..#..#.###..# +......##.##..###. +#....##..#..###.. +#....#.#.####.### +#.##.#.#.###.###. +######..######.## + +#.####..##..# +#.#.#........ +.#.###...#..# +#...#..##.... +...#.#.###..# +#..####.#.... +#####.#..#..# +.##..####.... +.....#...#..# +##.#...#.#### +.....###..... +###..##.#.... +.#..##.#.#### +#...#..#..##. +##...#....... +.#...#....... +#...#..#..##. + +...#..##. +..#.#.#.# +######.## +#####.### +..####... +######..# +######..# +..####... +#####.### +######.## +..#.#.#.# +...#..##. +#..###.## +####..##. +...#.#..# +...###.#. +..##.##.# + +.####.....#.# +........#.### +##..##...##.# +..##...####.. +..##...####.. +##..##...##.# +........#.### +.####.....#.# +######.##.#.. +.#..#.####.#. +##..####.##.# +#.##.##..#... +##..########. +##..##.##.#.# +.####....#.#. +.....#.#.#.#. +.#..#....#.## + +#..########..## +#............## +#.##########.## +.#.#.####.#.#.. +##.#......#.### +.#.###..#.#.#.. +###.######.#### +#.##.####.##.## +##.##....##.### +#.#.#.##.#.#.## +#.##......##.## + +.#......#..####.# +#.#.#####.#.###.. +##..##.#..#...##. +.##.#..###...#..# +.##.#..###...#..# +##..##.#..#...##. +#.#.#####.#.###.. +.#......#..####.# +#..##.#.##..#.#.. +#..##.#.##..#.#.. +.#.....##..####.# +#.#.#####.#.###.. +##..##.#..#...##. + +.#....#......#. +..#.##.######.# +...#.#..#..#..# +##..#.###..#.#. +##............. +##..#.########. +..#.##..####..# +..#.##..####..# +##..#.########. +##............. +##..#.###..#.#. + +####.## +###..## +#.##### +##..#.. +#...... +####.## +#.#.... +..###.. +..##### +#.#.... +####.## +#...... +##..#.. +#.##### +###..## +####.## +#####.. + +###.##..... +##.##..#..# +##.##.....# +###.##..... +#####...#.. +..######### +########.## +##.###...## +..#..#..#.# +..##...##.. +...####.#.# + +#.##...#....# +##....##....# +##..##..#..#. +##..##..#..#. +##.....#....# +#.##...#....# +.##.....####. +#####..#.##.# +#.####.#.##.# +.#.##.#.#..#. +#...#.#..##.. +###..##.####. +.#####....... + +#..##.# +#.###.. +#.###.. +#..##.# +.##.##. +...#... +#..###. +#..##.. +#..#..# +#..#..# +#..##.. +#..###. +.#.#... + +.###.## +.##.### +##..... +##..#.. +.##.### +.###.## +#...### + +..##..#.##. +.#..#.....# +.#..#.##.#. +######.#### +..##....... +..##....... +######.#### +.#..#.##.#. +.#..#.....# +..##..#.##. +#........#. +########..# +##..##..##. + +..######.....#... +...........##.##. +.#.####.#....#### +.#..##..#.####..# +####..#####...... +###########.#.##. +.#..##..#..###..# +###.##.###...#### +#..####..##.##### + +###.#####..##.. +...........##.. +.#.##...#..##.. +.#...##.##....# +.....#.###.##.# +..#####..#....# +##..###..##..## +####.##...#..#. +.#.##..##.#..#. +.####...##.##.# +...#.##..###### +..#..##..###### +..#..###..####. +..#..###..####. +..#..##..###### +.#.#.##..###### +.####...##.##.# + +..##.##..#..... +..##.##..#..... +.##...##.##...# +.....##..##.##. +#####.####..##. +.#......#.##..# +....##..###.##. + +#..#### +##.##.. +..#.#.. +..#.#.# +..#...# +.....#. +.#.#... +.#.#... +.....#. +..#...# +..#.#.# + +#.###.# +#####.# +.##..#. +.##..#. +#####.# +#.###.# +...#### +.#.##.# +......# + +#.##..##.####.# +..######..##..# +###....###..### +...####...##... +#........####.. +###.######..### +##.####.##..##. +##..##..######. +.#......#.##.#. +#.#....#.####.# +##......######. +..#....#..##..# +###.##.######## +.#......#.##.#. +.#......#....#. + +.##........#. +...#.##.##..# +.#..###..#### +...#.....#### +.#....##..### +#..#...#.#... +#.#...#.##.#. +#.#...#.##.#. +#..#...#.#... +##....##..### +...#.....#### +.#..###..#### +...#.##.##..# +.##........#. +.##........#. +...#.##.##..# +.#..###..#### + +....##....### +.########.... +##.#..#..#### +#...##...##.. +#........#.## +###.##.####.. +..##..##..### +..#....#..... +#..####..#### +##.####.##.## +##..##..##.## + +########.#.#.##.# +###..####.##....# +##....##...##..## +#......#.######## +#.####.##.##.##.# +#......##.#.#.... +#......##....##.. +.######.##....... +##....####.#.##.# +#..##..#.###....# +...##...#....##.. +.######....###### +##.##.##.#...##.. +#..##..#.#.##..## +.#....#.##...##.. + +###.#...####...#. +#..#.##..##..##.# +.##...##....##... +#####......#...## +#####......#...## +.##...##....##... +#..#.##..##..##.# + +####..#.##.#. +.#..##.####.# +#..#.#.####.# +#..#.#.####.# +.#..##.####.# +####..#.##.#. +.###.#.####.# +##....#...... +####.#..##..# +##..#...##... +...##.#....#. +##.########## +###.####..### + +#..######..#... +.###....###..## +.#.####.#.#..## +.###.##.###..## +..###..###..### +.#...##...#..## +###.#..#.###... +#.#.#..#.#.##.. +#..######..##.. +...#.##.#...### +..#......#..... + +......##.#. +##.#..#.... +##.#..#.... +......##.#. +#.#.#.##.#. +..#.#.###.# +#####..##.. +##.###.#..# +..#.##...#. + +##......###.### +##......###.### +#.##..##.##..#. +.##....##.###.# +..........#.#.# +..######...#..# +##.####.##...#. +..#....#..##..# +.###..###..##.# +.#......#.##.#. +.#......#.##..# +.#.####.#..#..# +###.##.######.. +##..##..#.#.... +.##.##.##...##. + +.#....#.#..#. +...##....##.. +##.##.##....# +#.#..#.#.##.# +.######..##.. +###..####..## +##.##.###..## +..#..#..#..#. +.#.####.#..#. +.#....#...... +#..##..##..## +.#....#..##.. +###..###....# + +##.##.##.###....# +.######.####....# +#......##.##.#..# +..#..#..##.##..## +.#....#..#.#.##.# +#..##..#..####### +..#..#...##.#..#. +...##.....####### +#.####.#.#.##..## +##....#######..## +.######..##.#..#. +.##..##..#..#..#. +###..####...#..#. +.#.##.#..#.#....# +.######.#.###..## +.........####..## +##.##.##......... + +....##.##.#.#..## +####.##.###.####. +#..##..#.####..## +.##....##.#.##.## +#..#...#.#.##.... +.##......##..#.## +#..#.##...#.#.#.. + +....##.## +....##.## +....#.... +..###.#.. +##.#.#### +....#.#.. +..#...... +###....#. +#...#.#.# + +.....##...###.#.# +.##.#.##.....#... +.##.#.##.....#... +.....##...###.#.# +#.######...###... +..#.#....#.##.#.# +##########.#..#.# +..#..#....###..#. +...##.#.##..###.. +#####.#.......##. +..#..#.#.#...##.# +..#..#.#.#...##.# +#####.#...#...##. +...##.#.##..###.. +..#..#....###..#. + +.#.##.#.....#.... +#.#..#.#.#.##.#.# +###..####......## +#.####.#..#..#..# +..#..#..###..###. +..####.....##.... +##....####....### + +##..#.##......# +..#.##.#.##.### +#..#......#.### +.##.##.#.....#. +#.#..##.##.##.# +#.#..##.##.##.# +.##.##.#.....#. +#..#......#.### +#.#.##.#.##.### +##..#.##......# +#....###.##.#.. +#....###.##.#.. +##..#.##......# +#.#.##.#.##.### +#..#......#.### + +..##.#...#.## +.#.##.#..#... +#..##..##..## +#......###... +...........## +.#.##.#.###.. +#.#..#.###... +.#.##.#.##.## +##....##.#### +.#.##.#....## +##.##.##..#.. +#.####.#.#### +#.####.#.#.## +.#....#.##.## +..#..#..##.## +#..##..##.... +#......#.#.## + +..#..###..... +.##.#.#...#.# +..######.#.#. +...#####.#.#. +.##.#.#...#.# +..#..###..... +#..#######... +.#..#.#...... +..####.#..#.. +...#..##.#### +.####.......# +#...#.##..#.# +...####.##.## +...####.##.## +#...#.##..#.# + +...###. +.#..### +.#..### +...###. +..#.#.. +.###..# +..#.#.# +.#.#.#. +.###..# +.###..# +.#.#.#. +#.#.#.# +.###..# +..#.#.. +...###. + +..######..... +##########..# +...####...... +#.######.#..# +#..#..#..#..# +#.##.###.#..# +##..##..##..# +##.####.##..# +##.####.##### +#.#.##.#.#..# +.#..##..#.##. +#...##...#### +..######..... +##.####.##..# +..........##. + +##.##.###.#...... +#..##..#.#..####. +#......###.#....# +#########.##....# +...##.....####### +#..##..#..#...... +#......####.#..#. +#..##..#..#...... +.##..##.#..#.##.# +..#..#...#.##..## +...##....#####.## +##########.#....# +##.##.#####..##.. +#.####.######..## +###..#######.##.# +#......#..#.#..#. +..#..#......####. + +.#..##.##..###. +.#.###.##..###. +#...#...#####.. +...##.####...## +....#.#####.#.# +##.#..#.###.#.. +.#.##.####..##. +##.#...##.##.#. +....######.#### +....#.#.##..### +..##...#......# +#####...####.## +#####...####.## +..##...#......# +....#.#.##..### +....######.#### +##.#...##.##.#. + +#..##.### +.##.....# +.##.##..# +###..#### +#####.#.# +......#.# +#..##.#.. +#..##.#.. +......#.# +#####.#.# +###..#### +.##.##..# +.##.....# +#..##.### +#..###### + +..#.#.#..#.#. +..#.#.#..#.#. +#...#.#..#.#. +.###.#..#..#. +.#.#..#.#.#.. +#.....#...### +##.##.#####.. +##.##.#####.. +#.....#...### +.#.##.#.#.#.. +.###.#..#..#. + +####...#.#. +####...#.#. +#..#..#..## +.....#..### +#..#.#..### +.........#. +.....###.## +######.#... +#..##.###.# +.........#. +..#..#.#.#. +#######.##. +####.#..#.# + +#..###. +#..###. +.....## +##.#... +#.#.#.. +.###.#. +#.##.## +##..##. +..###.# +...###. +.#.###. + +############...## +##..####..##.#... +##..####..##.##.. +.####..####..#.## +..##....##..##.#. +.####..####.#..#. +..............##. +#..........#.##.# +##############.#. +.#..#..#..#.#.#.# +............#.#.# +..##....##..###.. +#....##....#.###. +##############.## +.#..#..#..#.#...# + +.##......#.#### +....###..###.## +.....######.... +....#..##.##... +######....#.### +#..###.##....#. +########.#.###. +#..#####.#..### +.##..#...####.. +.##....##..#### +#...##.##.###.. +.##...#..###### +#..#.#.#.#.#... +.##...#..#....# +.##...#..#....# + +##.#.##.#.### +.#.##..##.#.# +#.#..##..#.#. +###.#..#####. +#.#.#..#.#.#. +##.######.### +#.##....##.#. +#.##....##.#. +##.######.### + +###..#####.## +###..#####.## +.....###..### +...##..###... +##.#.##.##.## +..##.....#.## +#.###........ +#...##...##.# +#.####.##.#.. +#.#..###.#### +.#.#.#####... +#.##.##.##... +####...####.. +#####....#### +.#.##.##.#... +.##.##..##... +.#.#...##.#.. + +.###..### +.#.#....# +.#..##..# +.#......# +...#..#.. +##..##..# +####..### +##.#..#.# +#.##..##. +#.##..##. +##.#..#.# +####..### +##..##..# + +###...#.... +...##.#.#.# +..######### +..##....#.# +..#######.# +..#....##.. +..#....###. +..#######.# +..##....#.# + +####......#...### +#.#..#..##..#..#. +##.##..####..##.# +..###...##...###. +.######....###### +..#####....#####. +#.###...##...###. +.#......##......# +...#..######..#.. +...#..######..#.. +.#......##......# + +...#..#.### +##.####.... +...##..#### +###...#.... +..#..#...## +##..#.##... +...##...##. +.......#### +####..###.# +.....#.#..# +##....#.... +#######.### +##.####.### + +#.#..#... +..##..#.. +..##..#.. +#.#..#... +.####.... +##..#.### +...##.... +...#...## +..#..#### +.#.##...# +....#.... + +..#####.....##. +#.##..#....##.. +........####..# +......#.###..## +....###....##.# +....###....##.# +......#.###..## +........####..# +#.##..#....##.. +..#####.....##. +.##.#..#.#.#.## +.##.#....#.#.## +..#####.....##. + +.#.#.#.## +.#.###.## +.##...#.. +##.##.##. +##.#..#.. +..#..#.#. +##.#.#.## +##.#.#.## +..#..#.#. + +..#.##### +##...#..# +##.###..# +######..# +##...#..# +..#.##### +.#.#..... +#.....##. +...#.#### +####.#### +##....... +#..#.#..# +...##.##. +#.#.##..# +###...... +....##### +..##..##. + +...##...# +...###### +...##.... +###..#.## +##.#.#.## +.#...#.#. +..#.#.### +.....##.. +###.#.... +##.#.#.#. +##.#.#.#. + +....#.....#.. +#..##.#....#. +##........... +..##.##...##. +.###..#..###. +##.########.# +##..###....## +###.##..#.##. +###.##..#.##. +##..###....## +##.########.# +.###.....###. +..##.##...##. +##........... +#..##.#....#. +....#.....#.. +....#.....#.. + +..##.#.#. +#####.#.. +#...####. +##.###... +##....#.# +##.#.#... +...#####. +##..#...# +.....###. +###..##.# +###.#.### +###.#.### +###..##.# + +..#.### +.....#. +..#...# +..#..## +####.## +###.#.# +###.#.. +####.## +..#..## +..#...# +.....#. + +.###.#.#.##.#.. +#.####..##..#.# +#.####..##..#.# +.###.#.#.#..#.. +....#...#..##.# +..####.##.#...# +##..#.#..#..##. +###..#...#..... +###..#...#..... + +#...#.....##. +#.###.#..#### +..###.######. +.#..####..##. +.#..####..##. +..###.######. +#.###.#..#### +#.........##. +.##.##.###... +#.##..#####.. +##..######..# +###.#...#.... +.#.#.######## +###......###. +....######.#. +.###.##.##.#. +.###.##.##.#. + +#..#..#....#..# +..###.#.##.#.## +##.###......### +##...########.. +.....#......... +#...###....###. +#...###....###. + +.#..#....#..#.. +#....#..#####.. +.####.###..##.. +#....#####.##.. +..##.......#.## +.......#.##..## +##..###..###... +.###....#.#.#.. +.#..#...##..... +#....#..##.#### +##..###.####.## +..##..#...#.#.. +.........#..### + +.####.. +#...#.# +..##..# +#..###. +#..###. +#.##..# +#...#.# +.####.. +..##.## +..##... +#....#. +#.#..#. +#.#..#. + +#####...#..## +#.###...#..## +.#####.#.#... +.##.##..##### +....##.###... +..#.#.###.### +.##....##..## +##..#.###.### +##...###.#... +.#.##.#.#..## +.#.#...#.#### +#....#...#... +...##..##..## + +.....#.#..... +....##....... +#..#.#.##.... +#####.##..... +#....####.##. +#..####...##. +#..###.#..##. +....##..##### +#####.###.... +....#.###.... +####.#...#..# +#######...... +....#.##.#### +.##....#.#..# +....###.##..# + +##.####......##.# +....#.###.#...##. +....#.###.#...##. +##.####......##.# +.##..#.##...#.### +.#.#.#...#...#... +#.##.#..##.#.#.#. +#.##.#.###.#.#.#. +.#.#.#...#...#... + +#####..####..#### +...###..##..###.. +..##..........##. +##.#..##..##..#.# +##....#.##.#....# +##.#.#..###.#.#.# +..#.###....###.#. +..##..........##. +..###...##...###. +....#.##..##.#... +.....#......#.... + +.####..#..#..## +..##...#..#.... +......###...### +......##.##..#. +#....#.#.#.#... +######.###...## +.####.#.#..##.# +.......#.#..#.. +.......#.#..#.. +.####.#.#..##.# +######.###...## +#....#.#.#.#... +......##.##.##. + +#.#..##.#.#.. +.#..##..#..## +.#..##..#..## +#.#..##.#.#.. +..#..#...#.#. +.#...#.#.###. +#.#####.#.##. +#...#...#.#.. +#...#...#.#.. +#.#####.#.##. +.#...#.#.###. +..#..#...#.#. +#.#..##.#.##. + +#..##......##..#. +#..##......##..#. +.#.#.#.##.#.#.#.# +#..#.######.#..## +.#..##.##.##..#.# +#...#..##..#...#. +#.############.#. +#..##.#..#.##..## +#..###....###..## +##.#...##..##.### +.##.##....##.##.. + +..###.#.##.#.###. +.##.##..##..##.## +.##.##..##..##.## +..###.#.##.#.###. +.##..#.####.#..## +###.##..##..##.## +###.#.#.##.#.#.## +.#..............# +#...###.##.###.#. +###...#....#...## +.##..#..##..#..## +..#..##....##..#. +..#.#.######.#.#. +###..##.##.##..## +..#..#.#..#.#..#. + +###.##.## +##..##..# +#.######. +#.######. +##..##..# +###.##.## +.###..### +#.#....#. +..#.##.## + +....#.##..# +......#.##. +#.####.#..# +#.####.#..# +......#.##. +....#.##..# +.#.##.#..#. +.##..##.... +#....##.##. + +.##...##.#. +.#.##...##. +#..#####.## +#..#####.## +.#.##...##. +.##...##.#. +.#..###...# +###.##.##.# +#...##.#.## +#...##.#.## +.##.##.##.# +.#..###...# +.##...##.#. + +.##...##. +.##...##. +##..###.# +##.#.#..# +.....#... +#..#.##.# +........# +..##.###. +..##.###. +........# +#..#.##.# +.#...#... +##.#.#..# +##..###.# +.##...##. + +####..#..##.##.## +....#.##......... +....#...#.######. +.....##..##....## +.....####........ +####..#...##..##. +....###.##.#..#.# +#####.....##..##. +.##.....#...##... +.##.##.#..######. +#..#####..#.##.#. +#..######.##..##. +..#.#.#.#.######. +.##...#..##.##.## +####..####.####.# + +#...#.# +#..#.## +##..### +##..##. +#..#.## +#...#.# +.#....# +#..##.# +...#.#. +###...# +##..### +.#####. +.#####. +##..### +###...# + +##.##..##.##.#..# +.##..##..#..##..# +#############...# +....#..#........# +#..##..##..#.##.. +#..#....#..###### +#....##....###.## +###.####.#####..# +.#..####..#.#.### +##..#..#..###..#. +..##.##.##...##.# +.##..##..##.....# +...............#. +...............#. +.##..##..##.....# +..##.##.##...##.# +##..#..#..###..#. + +#.####### +##.#...## +#..##..## +#..#.##.. +##.##..## +###.##### +###.##### +##.##..## +#..#.##.. +#..##..## +##.#...## +#.####### +..#.#.#.. +#...#.##. +.#.#..#.. +.#.##..## +#.#..#### + +.......#.#...#### +....#..#....#.##. +..##...#...###### +##.#....#.##.#### +##..##...#####..# +.##...#####.##### +.####..##.#...##. +#..#..#####..#..# +#..#..#####..#..# +.####..##.#...##. +.##...#####.##### +##..###..#####..# +##.#....#.##.#### +..##...#...###### +....#..#....#.##. diff --git a/day13/sample1.in b/day13/sample1.in new file mode 100644 index 0000000..3b6b5cc --- /dev/null +++ b/day13/sample1.in @@ -0,0 +1,15 @@ +#.##..##. +..#.##.#. +##......# +##......# +..#.##.#. +..##..##. +#.#.##.#. + +#...##..# +#....#..# +..##..### +#####.##. +#####.##. +..##..### +#....#..# diff --git a/day13/sol.tcl b/day13/sol.tcl new file mode 100755 index 0000000..98993b9 --- /dev/null +++ b/day13/sol.tcl @@ -0,0 +1,58 @@ +#!/usr/bin/env tclsh +source ../prelude.tcl + +set input stdin +set patterns [read $input] +set patterns [string trim $patterns] +#puts "$patterns" +set patterns [string map {"\n\n" "|"} $patterns] +#puts "$patterns" +set patterns [split $patterns "|"] +#puts "$patterns" +set patterns [lmap p $patterns {split $p "\n"}] +puts "$patterns" +#puts "$patterns" + +proc reflect pattern { + set total 0 + foreach pat [list $pattern [transpose $pattern]] factor {100 1} { + #puts "reflect $pat" + for {set i 1} {$i < [llength $pat]} {incr i} { + set ok 1 + for {set j 0} {$i + $j < [llength $pat] && $i-$j-1 >= 0} {incr j} { + if {[lindex $pat $i+$j] ne [lindex $pat [expr {$i-$j-1}]]} { + set ok 0 + break + } + } + if {$ok} { + #puts "$i $factor" + incr total [expr {$i * $factor}] + } + } + } + return $total +} + +proc column {lst i} { + set c {} + foreach row $lst { + lappend c [string index $row $i] + } + return [join $c ""] +} + +proc transpose pat { + set C [string length [lindex $pat 0]] + set out {} + for {set i 0} {$i < $C} {incr i} { + lappend out [column $pat $i] + } + return $out +} + +foreach pat $patterns { + puts "[reflect $pat] <| $pat" +} + +puts [ladd [lmap pat $patterns {reflect $pat}]]