diff --git a/rust/2023/README.md b/rust/2023/README.md
index 317a63e..8fdd9dc 100644
--- a/rust/2023/README.md
+++ b/rust/2023/README.md
@@ -28,6 +28,7 @@ You try to ask why they can't just use a weather machine ("not powerful enough")
| [Day 10: Pipe Maze](https://github.com/believer/advent-of-code/blob/master/rust/2023/src/day_10.rs) | 🌟 | 6882 | 🌟 | 491 |
| [Day 11: Cosmic Expansion](https://github.com/believer/advent-of-code/blob/master/rust/2023/src/day_11.rs) | 🌟 | 9795148 | 🌟 | 650672493820 |
| [Day 12: Hot Springs](https://github.com/believer/advent-of-code/blob/master/rust/2023/src/day_12.rs) | 🌟 | 8270 | 🌟 | 204640299929836 |
+| [Day 13: Point of Incidence](https://github.com/believer/advent-of-code/blob/master/rust/2023/src/day_13.rs) | 🌟 | 27300 | 🌟 | 29276 |
## Performance
@@ -47,6 +48,7 @@ With the help of [cargo-aoc](https://github.com/gobanos/cargo-aoc) I get automat
| 10 | 65.17 µs | 65.01 µs | `-96.02%` / - | 50.84 µs |
| 11 | 846.06 µs | 844.65 µs | | 75.21 µs |
| 12 | 2.65 ms | 149.26 ms | | 113.10 µs |
+| 13 | 24.87 µs | 17.61 µs | | 169.28 µs |
\* compared to first solution
\*\* slow, didn't benchmark. Value comes from running the solver.
diff --git a/rust/2023/input/2023/day13.txt b/rust/2023/input/2023/day13.txt
new file mode 100644
index 0000000..51ca5ad
--- /dev/null
+++ b/rust/2023/input/2023/day13.txt
@@ -0,0 +1,1345 @@
+.##.#....####..
+###....###...##
+.....###..#####
+.....###..#####
+###....###...##
+.##.#....####..
+#.#..#.#...#.##
+##..#.##.#.##..
+.#.#.#.#..#.###
+.#.###.#..#..##
+.#..#.....#.###
+..###.###..##..
+...#.#..#..####
+#.####.##..#.##
+..##.##.###.###
+#.#.##.#..#.###
+#..###...###.#.
+
+....##..##...
+..#..####..#.
+.############
+.############
+..#..####..#.
+....##..##...
+###......#.##
+
+.##..#..#.###
+.##.#...#..##
+..#.######.#.
+.......#.....
+.......#.....
+..#.######.#.
+.##.#...#..##
+.##..#..#.###
+####.#####.#.
+####.#####.#.
+.##.....#.###
+
+#..##.##.
+#...###..
+##..###.#
+##.##..##
+##.##..##
+##..###.#
+#...###..
+#..##.##.
+##.##.###
+..##.....
+..#...###
+..##..#..
+..#...#..
+..#...###
+..##.....
+
+..##.##.##...
+##.#......###
+..########...
+#####..######
+..#......#...
+.####..####..
+#....##....##
+....#..#.....
+#...####...##
+##.#....#.###
+#...#..#...##
+#####..######
+##..#..#..###
+.#...##...#..
+..#.#..#.#...
+
+.####..
+.####..
+##..###
+..##...
+.####..
+##..###
+#.##.#.
+.####..
+#####.#
+
+#.#..##..#.#..###
+#.##.##.##.#.####
+#.#......#.#.#...
+#..........#.####
+.##########..#.##
+#..######..####..
+##...###..##.####
+#..........######
+#.########.#..#..
+.#..#..#..#.###..
+.##..##..##..#...
+#.########.#..#..
+...#....#...#..##
+
+#......
+.#.#.#.
+.##..##
+.##...#
+.#.#.#.
+#......
+#.###..
+#.###..
+#......
+.#.#.#.
+.##...#
+
+.##.##.
+#.##..#
+....##.
+#..####
+##.#..#
+####..#
+.#.....
+##.#...
+..#.##.
+###.##.
+###.##.
+
+....#.##.
+#.#....#.
+#.#....#.
+....#.###
+.#....###
+.####.##.
+...##....
+##.######
+.##.#....
+#..#.##.#
+.####.###
+#...####.
+#...####.
+
+..##...###..#..#.
+..##...###..#..#.
+####.#.#.#..#.#.#
+..###.#....#.####
+##.###.#####...##
+...#.#...##..#...
+...#..###....#..#
+###.....#......#.
+#.###...#####.##.
+..###.#.##..#..#.
+..#####.#.#......
+###....#.#.#..##.
+..#.####.##.#....
+
+.###..#.#
+.###..#.#
+..##.##.#
+#.#####.#
+#.#.#####
+.###.....
+##.#.##.#
+.#.###.#.
+#.####.##
+#.####.##
+.#.###.#.
+##.#.##.#
+.###.#...
+
+########.
+...#.#.##
+#..#####.
+#..#.....
+..##.#...
+..##...#.
+..##...#.
+..##.#...
+#.##.....
+#..#####.
+...#.#.##
+########.
+##.##.###
+....#####
+..#.....#
+..#.....#
+....#####
+
+....##....#
+.##.#.####.
+#..#.######
+#..###.##.#
+....#.#..#.
+#.#########
+....##....#
+#..##......
+#####..##..
+#..#..####.
+.##...#..#.
+
+........#......
+.........#.####
+##....##....#..
+.##..##...##..#
+.##..##.##...#.
+########.####.#
+########.####.#
+.##..##.##...#.
+.##..##...##..#
+##....##....#..
+.........#.####
+........#......
+.#...##.#.#...#
+#.#..#.#....##.
+###..####.####.
+#......#...##.#
+##########...##
+
+##.#.#..#####
+##.###.#.#...
+.....##..#...
+####.######..
+.##..###.#.##
+#.####.####..
+.#...#..#.#..
+.###.##..#.##
+##.##...#####
+#..####.#####
+...##.....###
+#.#...###..##
+#.#...###..##
+...##...#.###
+#..####.#####
+
+....#..##.#..####
+#.##.######.###.#
+#####.#.#.#.#....
+#####.#.#.#.#....
+#.##.######.###.#
+....#..####..####
+..##.#####.....##
+#.#.#....###.#..#
+..#...#.##.####..
+.##...###.#.###..
+.##...###.#.###..
+
+.###.#..#.###..
+#.#.#.##.#.#.##
+..#.######.#...
+..#...##...#...
+#.##.####..#.##
+##.########.###
+..#..####..#...
+#.##......##.##
+##.#..##..#.###
+
+##.#........#.###
+###..##..##..####
+#..#..#.....#..##
+...#.##..##.#....
+#..#..#..#..#..##
+...###.##.###....
+#.#####..#####.##
+....########.....
+..#.#..##..#.#...
+.#.###.##.###.#..
+..##..####..##...
+#.#..#....#..#.##
+.#..##.##.##..#..
+####..####..#####
+##.#.##..##.#.###
+
+#.#.##.#.###..#
+##......###.##.
+....##...##....
+####..######..#
+.##....##.#####
+#........#.....
+##......####..#
+
+..###.#..####
+..###.###..##
+..###.###.###
+..#.#..#....#
+..#.#..##...#
+..###.###.###
+..###.###..##
+..###.#..####
+###..#...#.##
+###....#.#.#.
+...#.###..##.
+######.###..#
+##......#..#.
+
+.#######.##.#####
+.#...#........#..
+##...###....###..
+##...###....###..
+.#...#........#..
+.#######.##.#####
+#.####..####.####
+#.##..########..#
+.#.#...#....#...#
+..###..#....#..##
+...#.#..#..#..#.#
+
+##.#...##...#
+...#.#....#.#
+###.#.####.#.
+..###.####.##
+##.#.#....#.#
+##..#..##..#.
+......####...
+##.#.#....#.#
+..#.##....##.
+......#..#...
+...##.####.##
+..#....##....
+##...######.#
+
+............#.#
+##.#....#.###..
+.##.#..#.##...#
+###########..##
+....####....##.
+#..##..##..##..
+####....####.#.
+...#.##.#......
+#..#....#..###.
+.#........#.###
+.#.#....#.#...#
+.##......##.###
+....####....#..
+##.#....#.##.##
+#..######..###.
+#...#..#...###.
+#...#..#...###.
+
+.#..#.#.#
+.#..#.#.#
+....##..#
+#.#######
+##..#..#.
+.#.#.#..#
+...#....#
+.###..#.#
+...#..###
+.#.##.##.
+#####...#
+#####...#
+.#.##.##.
+...#..###
+.####.#.#
+...#....#
+.#.#.#..#
+
+##.#.#.
+###..##
+##.#.##
+.###...
+.###...
+##.#.##
+###..##
+##.#.#.
+...###.
+.#.###.
+##.#.#.
+###..##
+##.#.##
+
+.####..##
+.#.##..##
+##.######
+.....##..
+###..##..
+....#..#.
+##.######
+....####.
+.#.#....#
+
+#.#..#.#.##..##
+........#.#####
+...##....#..##.
+.#.##.####.###.
+########.#.#.##
+##.##.##..##..#
+..#..#..##..#.#
+..#..#..##..#.#
+##.##.##..##..#
+
+..#...#.#######
+#.##....#..##..
+..###..########
+#....#.##..##..
+#....####..##..
+..###..########
+#.##....#..##..
+..#...#.#######
+..####.###....#
+#####.###.####.
+.##..####......
+...##...##.##.#
+#...###..######
+
+#..#...#..#
+#......#..#
+.##......#.
+####..#.###
+..##..##...
+#.##.#.#..#
+#...##.###.
+##.#...##..
+##..###...#
+##..###...#
+##.#...##..
+#...##.###.
+#.##.#.#..#
+
+.########....##..
+###.##.###.##..##
+..#.##.#..##.##.#
+.##....##..######
+##.#.##.##..####.
+##.#..#.##.#....#
+..######.........
+
+.##..##.#.#..#.
+#......########
+#########......
+#########.####.
+###..###.#.##.#
+##.######.####.
+##.##.##.......
+.######..#....#
+..####...##..##
+########..#..#.
+..#..#..##.##.#
+#.#..#.###....#
+...##....#....#
+...##....#.##.#
+#......##..##..
+#########.#..#.
+...........##..
+
+#....#..#.#.##.
+...##.#...#####
+...##.#....####
+#....#..#.#.##.
+..###.###...##.
+#..##..##.##..#
+##...#......##.
+.####.#..#.....
+.##.##.#....##.
+.#..#..#.##.##.
+##.##.###......
+#..#.....##....
+#.#..#..#..####
+.###.#.#...####
+...#....#######
+..#.#.#...#.##.
+...#........##.
+
+.......##.......#
+#..###....###..#.
+####.######.#####
+....###..###.....
+.##..#....#..##..
+.##..#....#..##..
+#####.####.######
+.##.###..###.##.#
+.##.#..##..#.##..
+#..#........#..##
+####.##..##.#####
+###.##.##.##.###.
+....###..###.....
+
+.....#........#
+.....#........#
+..###...#.#.#..
+##.#.##....#..#
+###..#.#.####.#
+.###....#..#..#
+...#.#.#.#..##.
+...#.#.#.#..##.
+.###....#.....#
+
+#####.#
+.....##
+#####..
+#####..
+#..####
+####.##
+....#..
+....#..
+####.##
+#..####
+######.
+
+##.##.#######
+.###.#...##..
+###.##...##..
+..#.#....##..
+#..###.######
+.#.#.#.#....#
+...#...##..##
+..##.##......
+..##.####..##
+.##.##.##..##
+.#####.######
+
+....##...
+..#....#.
+....##...
+####..###
+####..###
+##.#..#.#
+..#....#.
+###.....#
+..#....#.
+..##..##.
+...####..
+
+#########....
+##.##.####...
+.#....#..#...
+#.#..#.##.#..
+.##..##..#...
+.########....
+#.####.#.....
+#..##..#.##..
+########.....
+.######.#####
+.######...#..
+..####..##...
+#.####.#.####
+#.####.#.....
+...##......##
+
+...##.##.....#.
+..###.##.....#.
+....##.#..###.#
+..####.#.###.#.
+##...##..###.#.
+##.####...##..#
+###.##.####.#.#
+...#....#.#....
+##.#####..##.##
+....##.#.###...
+##.#.####.#.###
+......##..##.##
+####.#..####..#
+
+.##..#.##
+#..##.##.
+#..##.###
+.##..#.##
+####..##.
+....#.###
+.##...#..
+
+...#..##..#..#..#
+.#.#..##..#..#..#
+#......#.#.##.#.#
+#...####.#.##.#.#
+...###.###....###
+...#.#...######..
+#..####..........
+..##..##.#.##.#.#
+##.#.#..#..##..#.
+
+####.#..#.####.
+.##..####..##..
+##.##.##.##.###
+..###.#..###...
+##.#..##..#.##.
+##..######..##.
+...###..###...#
+...###..###...#
+##..######..##.
+##.#..##..#.##.
+..###.#..###...
+
+..##..##..#.##..#
+.####.###########
+.#..#.##........#
+.####.##..#..#..#
+##..##.#.#.##.#.#
+#....#..###..###.
+......#..........
+
+#.#..##.###..##
+####.#.#..#..#.
+..##.#..###..##
+.#..##..##.##.#
+.#..#...#######
+##.#.#####.##.#
+#.#.......#..#.
+#.#...#........
+#...#...#######
+#.#...#.#.#..#.
+.#...#..#.#..#.
+##.#..##..#..#.
+####..##..#..#.
+
+####..#...###..#.
+.##.#.#.##.######
+..#.##...######.#
+##.##..##.#####.#
+#.##....#........
+#.##....#........
+##.##...#.#####.#
+..#.##...###...##
+..#.##...###...##
+##.##...#.#####.#
+#.##....#........
+#.##....#........
+##.##..##.#####.#
+
+####..###.######.
+#....##.####..###
+#....##.####..###
+####..###.######.
+#..#.####.#.##.#.
+#####....#..##..#
+.#.#...#...#.##..
+...##.#.#..#..#..
+#.#.#..#.#......#
+#.####.##........
+#.###...#..#..#..
+.#####.#.########
+....#..#...####..
+.#..#.#.##.####.#
+..##..#.#.#....#.
+.##.#..###.####.#
+.#....#..########
+
+#..##...#..#....#
+####.#.#....#..#.
+.#.....###.######
+..####.##.##.##.#
+..####.##.##.##.#
+.#.....##########
+####.#.#....#..#.
+#..##...#..#....#
+#...######.######
+##..#.#...##....#
+#....###.####..##
+#...##..###.####.
+.###..#....#.##.#
+
+..##.#..#.##...
+..#.#....#.#...
+..#.#....#.#...
+..##.#..#.##...
+.####.##.####.#
+#.#.######.#.##
+#.#.#.##.#.#.##
+..###.##.###.##
+#..##.##.##..##
+##.##.##.##.##.
+##..##..##..##.
+
+#.###.##.#.#.##.#
+#..####....######
+##...##..###....#
+####..#.###.#..#.
+##.##...#.#..#...
+...#...##.#..##..
+###.#.#.#.#..##..
+..#..##.##.#.##.#
+.##.####.#.......
+.##.####.#.......
+..#..##.##.#.##.#
+###.#.#.#.#..##..
+...#...##.#..##..
+
+....##...
+....##...
+####.#..#
+.##.#.#..
+..#.###.#
+.##.#.###
+#####.###
+.##.###..
+#####.##.
+
+.#.#......#######
+###.###....#.####
+#...#.#.##...####
+.###.#..##...####
+#####....####....
+#.##..##.#...####
+#.#.###.#.....##.
+.##.###.#..#.....
+###..#..##.#.####
+..#.#.#..#.#.....
+.###....#........
+####.#..##..#....
+#.##....#..#.####
+.###.###.#..#####
+.##..#.#..#######
+
+...#.####
+....###.#
+#.#.#...#
+#.#.#...#
+....#.#.#
+...#.####
+##.#..#.#
+##..#....
+.#....###
+##...#.##
+##...#.##
+.#....###
+##..#....
+##.#..#.#
+...#.####
+....#.#.#
+#.#.#...#
+
+##..##..#######
+..######.......
+....##....####.
+....##....####.
+#..#..#..######
+#.#....#.##..##
+###....########
+###....###....#
+.#......#..##..
+...####...#..#.
+#.#....#.######
+#.#####..##..##
+..#....#..#..#.
+####..#########
+...#..#...#..#.
+
+####...####
+####...####
+##...#....#
+.####..####
+...##..#...
+.##.#.#..#.
+##..#..#..#
+#.#..##.#.#
+.#..##..#.#
+##.#####...
+####.####..
+####.####..
+##.#####...
+.#..##..#.#
+..#..##.#.#
+
+#.#.#.#.###
+#...#.#.###
+.######.#.#
+####......#
+..#.##.###.
+.##...###..
+.##...###..
+..#.##.###.
+####......#
+.######.#.#
+#...#.#.###
+
+##..#.#
+...#.##
+...#.##
+.#..#.#
+####..#
+.#####.
+.#####.
+
+#.##.#.##....
+#######..####
+....#.#.##..#
+..##..##..##.
+......###....
+.#..#.###....
+#######.##..#
+########.....
+.#..#.##.####
+#.##.#...####
+#....#.#.#..#
+##..##...####
+##..##.######
+
+#..##.#..##
+##.##.#.###
+####....#..
+####....#..
+##.##.#.###
+#..##.#..##
+#...#....#.
+...##.####.
+##..##...##
+.#...#.#...
+.###.#.##.#
+#..###..##.
+#..###...#.
+.###.#.##.#
+.#...#.#...
+
+..#.####.#..##.
+.....##.....###
+..#.#..#.#...#.
+##.#....#.####.
+.#........#.#.#
+...##..##...##.
+###.####.###..#
+###......######
+####.##.####.##
+
+...##....####....
+########..##..###
+########......###
+#......#..##..#..
+#.#..#.#..##..#.#
+#.#..#.########.#
+...##...######...
+.#....#.######.#.
+#..##..##.##.###.
+#########....####
+##....###....###.
+
+..#.##..######..#
+..#.##..######..#
+##.##..#..##..#..
+#...#.#..####..#.
+.....#..######..#
+.#.##.####..####.
+#...#.#.#....###.
+##...#####..#####
+..#..#.#..##..#.#
+
+.......####
+##..##.#.#.
+##..###.#..
+#.##.##..##
+#....##..##
+.####.##...
+#######....
+##..###....
+.#..#.##...
+.#..#.#..##
+......###..
+..##....#..
+##..####.##
+
+.##....#.
+####....#
+.##..##..
+...##..##
+...##..##
+.##..##..
+####....#
+
+#.#.#.#.###
+...##.....#
+.######.##.
+......#.##.
+.#####.#...
+.#...##...#
+.#...##...#
+.#####.#...
+.#....#.##.
+.######.##.
+...##.....#
+#.#.#.#.###
+##.#.##.#.#
+.#.##..#.#.
+.#....###..
+.#....###..
+.#.##..#.#.
+
+#....#.####..
+#.####.###..#
+.#..#.#..#.#.
+#.#..#....##.
+#######..####
+.#.#####.###.
+.#.#####.###.
+#######..####
+#.#..#....##.
+.#..#.#..#.#.
+#.########..#
+#....#.####..
+#....#.####..
+
+.#...###.##.#
+.......######
+.##.##..#..##
+....#.#...#..
+.##.###..#.##
+.##.####..#.#
+####.###.#..#
+#..#.#....###
+....##.....#.
+....##.....#.
+#..#.#....###
+
+.##.##..#......
+.#.#.....##.###
+.#.#.....##.###
+.##.##..#......
+...#..##..#.#.#
+#####.#....#.##
+#####.###.#.###
+..#.#.#.#..##..
+..#.#.###..#...
+
+#.#...##.##..
+####.##.#####
+#...#....#.##
+##..####.##..
+##.#.#..#....
+.##..##.#..##
+.#..#.##.####
+.#..#.....#..
+#######.#####
+##.##..#.....
+##.##........
+#######.#####
+.#..#.....#..
+.#..#.##.####
+.##..##.#..##
+##.#.#..#....
+##..####.##..
+
+..#.###..###.#..#
+..#.###..###.#..#
+......#..#.......
+.#..##....##..#..
+.#.#...##...#.#.#
+..#.#......#.#...
+##............##.
+#.##........##.##
+..###.#..#.###...
+.#....#..#....#..
+#...#.#..#.#...##
+######.##.######.
+.#.##########.#.#
+##.#.#.##.#.#.##.
+.#.#.##..##.#.#..
+#.############.##
+#####......###.#.
+
+#..#...
+..#####
+.#....#
+.#..###
+#...###
+.#.####
+.#.#...
+...####
+.#.##..
+..###..
+...##..
+...##..
+..###..
+.#.##..
+...####
+
+#.#######....#.#.
+#..#.##.##......#
+...#.##.##......#
+#.#######....#.#.
+#.#######....#.#.
+...#.##.##......#
+#..#.##.##......#
+#.#######....#.#.
+##.#.#######....#
+###.###...##.#...
+#..#....#####....
+..#.#..##.......#
+###.######.#.#.#.
+.#.#####.........
+...##.#..######..
+.###.#.##..#####.
+#...#.#..#.###.##
+
+#...#.#
+####...
+####...
+#...#.#
+.....##
+..##.##
+.##...#
+..##...
+#.##.##
+..###..
+..###..
+#.##.##
+..##...
+..#...#
+..##.##
+
+.#..#..##.#...##.
+.#..#..##.#...##.
+#.#.#####..####.#
+....#.##....#.##.
+.##.##.#.####....
+###..###.....####
+#.##.#..##.......
+
+.#.#.###.#.##
+#.###..#.#.##
+#####.#.###..
+#####.#.###..
+#.###..#.#.##
+.#.#.###.#.##
+#....##..#...
+#...####..###
+##.#.###..#.#
+##..#...#.###
+##..#...#.###
+##.#.###..#.#
+#...####..###
+#....##..#...
+.#.#.###.####
+
+.##.##.
+#..#.#.
+######.
+#..#...
+#..#..#
+#..#..#
+#..##..
+######.
+#..#.#.
+
+.##.#.##.#..#.##.
+.##.#.##.#..#.##.
+###.#.##.#.##....
+#.#.##.....#.####
+##..#.##.#######.
+....#.##.#.###..#
+..#......#.##....
+.#......###.#.##.
+#..#.###.#...#..#
+
+...##...#..##
+#.####.###...
+...##.....#..
+.#.##.#..##..
+##....###....
+........#..##
+#......####..
+#..##..#.....
+###..###..###
+.######..#...
+#.####.....##
+
+##....##..##..##.
+...#####.#..#.###
+####.##.######.##
+..##...#..##..#..
+##.#...########..
+..##....##..##...
+..#.#############
+..####....##....#
+###....##....##.#
+..##.###.#..#.###
+##...#.#......#.#
+##..##.###..###.#
+...#.#...####...#
+...#...##.##.##..
+###..##.##..##.##
+..#.#..##....##..
+..###.###....###.
+
+........#.###
+..##...#####.
+.####.#.##..#
+.####.#..#.#.
+##..####..#.#
+##..##..#...#
+##..##..#...#
+##..####..#.#
+.####.#..#.#.
+.####.#.##..#
+..##...#####.
+........#.###
+######.#.#..#
+##..####..###
+#....#..#....
+#.##.#.#....#
+##.####.###.#
+
+#.#..#.#.#.#.####
+###..#####....##.
+#..##..##..###..#
+#.######.###.#..#
+########..#..####
+.#.##.#.##...####
+#.####.#.#..##..#
+##....##..#..#..#
+..####...##..#..#
+#.####.#.#.......
+...##...###..#..#
+.#....#.###..#..#
+..#..#..#.#..####
+
+...#...###.#.#...
+.......#....#..##
+.##.....##.####..
+.#..######.#.##..
+.#####.....###...
+.#...###..###..##
+###.#..#....##...
+.#.####.#.#..#.##
+#.####..##.#.####
+#.#.##..##.#.####
+.#.####.#.#..#.##
+
+.##.#....#..#..#.
+#....####....#...
+#.#...##...#.####
+.#...####...#.###
+#.##.####.##.#.##
+.#.##.##.##.#.#.#
+#..###..###..##.#
+#..###..###..##.#
+.#.##.##.##.#.#.#
+#.##.####.##.#.##
+.#...####...#.###
+
+.#..#.##...
+.##..###...
+####..##.##
+.......#.##
+.##.#.#....
+....####...
+.##.#...#..
+####.#.##..
+.##..##..##
+
+.#.####..
+#..######
+##.##....
+.##.##...
+.##.##...
+##.##....
+#..######
+.#.####..
+#..#..###
+.#...####
+##.......
+##....#..
+#..#...##
+.###..###
+#...#...#
+.#..#....
+#.###....
+
+.##.###.###.###
+.#####.##.#..##
+.#####.##.#..##
+.##.###.#######
+.#.##....##.###
+##.###..#...###
+.#...#.#####.##
+##.###...######
+.#.#.##....##..
+##.#.#.##..#...
+###.##..##.#...
+#####....###...
+#....#......###
+
+.###...#.###.
+#...#.#.....#
+#...#.#.....#
+.###...#.###.
+.#..#....#..#
+#..###.##.#..
+#.##..#..#...
+#.######...#.
+#.######...#.
+#.##..#..#...
+##.###.##.#..
+.#..#....#..#
+.###...#.###.
+
+......####.#...#.
+......##.##..#.#.
+.#..#..#.####...#
+.#..#..##.##.####
+#.##.###..##..###
+#######.##..###..
+#.##.#....##..#..
+..##...###.######
+......##..##...##
+......#.#...#.###
+......#.#...#.###
+......##..##.#.##
+..##...###.######
+
+#..#..#..
+.....####
+.##.#...#
+.##.#...#
+.....####
+#..#..#..
+##.##.#..
+#..#..#..
+......#.#
+.##...#..
+####...#.
+#####.#.#
+#..#..#..
+.##..#...
+#####....
+#..#.####
+.......#.
+
+.....#.#.
+###...#..
+..#..#.##
+..###.##.
+##.##....
+##.##....
+..###.##.
+..#..#.##
+###...#..
+....##.#.
+...######
+
+...##.##.#..####.
+...##.##.#..####.
+#.####..#..#.....
+#..........#....#
+..#.##...#..#..#.
+.#...##..#.#.##.#
+.#.#..##...##..##
+#...#...#########
+.#.##.#..###....#
+
+..#.##.
+....###
+.....##
+##...##
+...#...
+##..##.
+###....
+...##.#
+##..#..
+..##..#
+..##..#
+##..#.#
+...##.#
+
+#..#..#......#..#
+#..#..#......#..#
+###.######.#..#.#
+.#.####.#.#####..
+##..####..###.#..
+.##...###.#.#.##.
+...#....#.#.#####
+##.#..####..#....
+##.#..###..#..##.
+##.#..###..#..##.
+##.#..####..#....
+...#....#.#.#####
+.##...###.#.#.##.
+##...###..###.#..
+.#.####.#.#####..
+###.######.#..#.#
+#..#..#......#..#
+
+..#...#.#.##.
+.###.#....##.
+.##.#..######
+#.##.##.#....
+#######..####
+#.#.##..#....
+##.#..#.##..#
+..#....######
+......#######
+......#######
+..#....######
+#..#..#.##..#
+#.#.##..#....
+#######..####
+#.##.##.#....
+.##.#..######
+.###.#....##.
+
+##..#..#..#
+...#...##..
+###..##..##
+..#..##..#.
+###.####.##
+###..##..##
+##.#.##.#.#
+##.######.#
+..########.
+
+##..###
+####.##
+.#.#...
+.....##
+..#.###
+..#.###
+###....
+##.....
+##...##
+..#....
+##.#...
+###.#..
+..#.###
+
+..##....#
+...####.#
+...##..##
+#####..##
+...######
+####....#
+.....##..
+...#.##.#
+##.#....#
+
+####...#.#.......
+#.#.####.####...#
+..#.##.#...##....
+..#.##.#...##....
+#.#.####.####...#
+####...#.#.......
+#..#.#..#.#.#.##.
+.#....#....#..###
+..#.##.#...#.#.#.
+..#.##.#...#.#.#.
+.##...#....#..###
+#..#.#..#.#.#.##.
+####...#.#.......
+
+#.######.
+#.#....##
+.#..#.###
+.#..#.###
+#.#....##
+#.######.
+......#.#
+.#....#.#
+#.######.
+#.#....##
+.#..#.###
+
+.##...#..#...##..
+##..#.####.#..###
+#......#.......##
+##..#..##..#..###
+..###..##..###...
+#..#..####..#..##
+#.##.#....#.##.##
+#.##.#....#.##.##
+.###.#....#.###..
diff --git a/rust/2023/src/day_12.rs b/rust/2023/src/day_12.rs
index 24dfb8d..f3a0d71 100644
--- a/rust/2023/src/day_12.rs
+++ b/rust/2023/src/day_12.rs
@@ -7,6 +7,9 @@
//!
//! So, this solution was an iterative process of trying to understand and implementing
//! the algorithm.
+//!
+//! I later tested a solutions using recursion and memoization. It was a bit easier to
+//! understand, but it was also slower.
use itertools::Itertools;
diff --git a/rust/2023/src/day_13.rs b/rust/2023/src/day_13.rs
new file mode 100644
index 0000000..2828bf9
--- /dev/null
+++ b/rust/2023/src/day_13.rs
@@ -0,0 +1,183 @@
+//! Day 13: Point of Incidence
+//!
+//! I had a super hard time understanding the problem description. I first thought that there
+//! was just line (vertical or horizontal) in each pattern. Had to read and re-read it
+//! multiple times before I understood.
+//!
+//! Haven't cleaned up part 2 yet, but it works. I'll get back to it later.
+
+use crate::grid::Grid;
+use crate::point::Point;
+
+#[derive(Debug)]
+pub struct Input {
+ patterns: Vec<(Grid, Vec)>,
+}
+
+#[aoc_generator(day13)]
+pub fn input_generator(input: &str) -> Input {
+ let patterns = input
+ .split("\n\n")
+ .map(|pattern| {
+ let grid: Grid = Grid::from(pattern);
+ let rocks = grid.find_all(b'#');
+
+ (grid, rocks)
+ })
+ .collect::>();
+
+ Input { patterns }
+}
+
+fn vertical_line(grid: &Grid, rocks: &[Point]) -> i32 {
+ let result = (1..grid.width).find(|&x| {
+ rocks.iter().all(|rock| {
+ let reflected = Point::new(2 * x - rock.x - 1, rock.y);
+ !grid.contains(reflected) || grid[reflected] != b'.'
+ })
+ });
+
+ result.unwrap_or(0)
+}
+
+fn horizontal_line(grid: &Grid, rocks: &[Point]) -> i32 {
+ let result = (1..grid.height).find(|&x| {
+ rocks.iter().all(|rock| {
+ let reflected = Point::new(rock.x, 2 * x - rock.y - 1);
+ !grid.contains(reflected) || grid[reflected] != b'.'
+ })
+ });
+
+ result.map(|x| x * 100).unwrap_or(0)
+}
+
+/* Part One
+*
+*
+*/
+// Your puzzle answer was
+#[doc = r#"```
+use advent_of_code_2023::day_13::*;
+let data = include_str!("../input/2023/day13.txt");
+assert_eq!(solve_part_01(&input_generator(data)), 27300);
+```"#]
+#[aoc(day13, part1)]
+pub fn solve_part_01(input: &Input) -> i32 {
+ input
+ .patterns
+ .iter()
+ .map(|(grid, rocks)| vertical_line(grid, rocks) + horizontal_line(grid, rocks))
+ .sum()
+}
+
+/* Part Two
+*
+*
+*/
+#[doc = r#"```
+use advent_of_code_2023::day_13::*;
+let data = include_str!("../input/2023/day13.txt");
+assert_eq!(solve_part_02(&input_generator(data)), 29276);
+```"#]
+#[aoc(day13, part2)]
+pub fn solve_part_02(input: &Input) -> i32 {
+ input
+ .patterns
+ .iter()
+ .map(|(grid, rocks)| {
+ 'vertical: for x in 1..grid.width {
+ let mut smudges = 0;
+ for rock in rocks {
+ let reflected = Point::new(2 * x - rock.x - 1, rock.y);
+
+ if grid.contains(reflected) && grid[reflected] == b'.' {
+ smudges += 1;
+
+ if smudges > 1 {
+ continue 'vertical;
+ }
+ }
+ }
+
+ if smudges == 1 {
+ return x;
+ }
+ }
+
+ // Skip the first row
+ 'horizontal: for y in 1..grid.height {
+ let mut smudges = 0;
+
+ for rock in rocks {
+ let reflected = Point::new(rock.x, 2 * y - rock.y - 1);
+
+ if grid.contains(reflected) && grid[reflected] == b'.' {
+ smudges += 1;
+
+ if smudges > 1 {
+ continue 'horizontal;
+ }
+ }
+ }
+
+ if smudges == 1 {
+ return y * 100;
+ }
+ }
+
+ unreachable!("This should never happen. Something blew up.")
+ })
+ .sum()
+}
+
+#[cfg(test)]
+mod tests {
+ use super::*;
+ use rstest::rstest;
+
+ #[rstest]
+ #[case(
+ "#.##..##.
+..#.##.#.
+##......#
+##......#
+..#.##.#.
+..##..##.
+#.#.##.#.
+
+#...##..#
+#....#..#
+..##..###
+#####.##.
+#####.##.
+..##..###
+#....#..#",
+ 405
+ )]
+ fn sample_01(#[case] input: &str, #[case] expected: i32) {
+ assert_eq!(solve_part_01(&input_generator(input)), expected);
+ }
+
+ #[rstest]
+ #[case(
+ "#.##..##.
+..#.##.#.
+##......#
+##......#
+..#.##.#.
+..##..##.
+#.#.##.#.
+
+#...##..#
+#....#..#
+..##..###
+#####.##.
+#####.##.
+..##..###
+#....#..#",
+ 400
+ )]
+ fn sample_02(#[case] input: &str, #[case] expected: i32) {
+ assert_eq!(solve_part_02(&input_generator(input)), expected);
+ }
+}
diff --git a/rust/2023/src/grid.rs b/rust/2023/src/grid.rs
index cce46a5..d0fd3c1 100644
--- a/rust/2023/src/grid.rs
+++ b/rust/2023/src/grid.rs
@@ -78,6 +78,10 @@ impl Grid {
.map(|i| Point::new((i as i32) % self.width, (i as i32) / self.width))
.collect()
}
+
+ pub fn contains(&self, point: Point) -> bool {
+ point.x >= 0 && point.x < self.width && point.y >= 0 && point.y < self.height
+ }
}
/// Used to get a value using a Point as index from the grid
diff --git a/rust/2023/src/lib.rs b/rust/2023/src/lib.rs
index 0b22368..8702090 100644
--- a/rust/2023/src/lib.rs
+++ b/rust/2023/src/lib.rs
@@ -21,5 +21,6 @@ pub mod day_09;
pub mod day_10;
pub mod day_11;
pub mod day_12;
+pub mod day_13;
aoc_lib! { year = 2023 }