summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJustin Wernick <justin@worthe-it.co.za>2023-12-23 13:17:53 +0200
committerJustin Wernick <justin@worthe-it.co.za>2023-12-23 13:17:53 +0200
commit355f718208976c5db13e91e48b8ca97a07bf5a94 (patch)
tree8e5aac78ed8c5118c3a895941bebbcd5cb4ad8b9
parenta00b89b6358646f6fc48aa285b500697840a5979 (diff)
Day 23 parsing
-rw-r--r--2023/inputs/day_23.txt141
-rw-r--r--2023/src/bin/day_23.rs46
2 files changed, 180 insertions, 7 deletions
diff --git a/2023/inputs/day_23.txt b/2023/inputs/day_23.txt
new file mode 100644
index 0000000..24abcfe
--- /dev/null
+++ b/2023/inputs/day_23.txt
@@ -0,0 +1,141 @@
+#.###########################################################################################################################################
+#.........#...#.....###...#...###...#...#####...#...#...#...###.........#...###...#####...#...#...#...#...#...............#.......#####...###
+#########.#.#.#.###.###.#.#.#.###.#.#.#.#####.#.#.#.#.#.#.#.###.#######.#.#.###.#.#####.#.#.#.#.#.#.#.#.#.#.#############.#.#####.#####.#.###
+#.........#.#.#...#.#...#.#.#...#.#.#.#.#.....#.#.#...#.#.#...#...#.....#.#...#.#...#...#.#.#...#.#.#...#.#.........#.....#.....#.....#.#.###
+#.#########.#.###.#.#.###.#.###.#.#.#.#.#.#####.#.#####.#.###.###.#.#####.###.#.###.#.###.#.#####.#.#####.#########.#.#########.#####.#.#.###
+#.....#...#.#...#.#.#...#.#.#...#.#.#.#.#.....#.#.#.....#...#.#...#.#...#.#...#.#...#.#...#.#.....#.....#...###...#.#.......#...#.....#.#.###
+#####.#.#.#.###.#.#.###.#.#.#.###.#.#.#.#####.#.#.#.#######.#.#.###.#.#.#.#.###.#.###.#.###.#.#########.###.###.#.#.#######.#.###.#####.#.###
+#.....#.#.#.#...#.#.#...#.#.#...#.#.#.#.#.....#.#.#.......#.#.#...#.#.#.#.#.###.#.###.#.#...#...#...###...#.....#...#.......#...#.#.....#...#
+#.#####.#.#.#v###.#.#.###.#.###.#.#.#.#.#.#####.#.#######.#.#.###.#.#.#.#.#.###.#.###.#.#.#####.#.#.#####.###########.#########.#.#.#######.#
+#.....#.#...#.>.#.#.#...#.#...#.#.#.#.#.#...#...#.#.......#.#.#...#.#.#.#.#...#.#.>.>.#...#.....#.#.#...#.........#...#...#.....#.#...#.....#
+#####.#.#####v#.#.#.###.#.###.#.#.#.#.#.###.#.###.#.#######.#.#.###.#.#.#.###.#.###v#######.#####.#.#.#.#########.#.###.#.#.#####.###.#.#####
+#.....#.#.....#.#.#.#...#...#.#...#.#.#.>.>.#.#...#.#.>.>...#.#...#.#.#.#.###...#...#.....#.#...#.#.#.#.#.......#.#.#...#.#.....#.....#.....#
+#.#####.#.#####.#.#.#.#####.#.#####.#.###v###.#.###.#.#v#####.###.#.#.#.#.#######.###.###.#.#.#.#.#.#.#.#.#####.#.#.#.###.#####.###########.#
+#.....#.#.....#.#.#.#...#...#.#.....#.#...#...#...#...#...#...#...#...#.#.#.....#.#...###...#.#.#.#.#.#...#.....#.#.#.#...#...#...#.........#
+#####.#.#####.#.#.#.###.#.###.#.#####.#.###.#####.#######.#.###.#######.#.#.###.#.#.#########.#.#.#.#.#####.#####.#.#.#.###.#.###.#.#########
+#.....#.#.....#...#.#...#.#...#.......#...#.....#.#.......#...#...#...#...#...#...#.....#...#.#.#.#.#.#.....#.....#.#.#...#.#...#.#.#.......#
+#.#####.#.#########.#.###.#.#############.#####.#.#.#########.###.#.#.#######.#########.#.#.#.#.#.#.#.#.#####.#####.#.###.#.###.#.#.#.#####.#
+#.......#.........#...###...#.......#.....#...#...#.........#.....#.#.#.....#.......#...#.#.#.#.#.#.#.#.#...#.....#.#.#...#...#.#.#.#.#.....#
+#################.###########.#####.#.#####.#.#############.#######.#.#.###.#######.#.###.#.#.#.#.#.#.#.#.#.#####.#.#.#.#####.#.#.#.#.#.#####
+#...###...#.......###...#...#.....#.#.#.....#...#...........###...#.#.#...#.........#...#.#...#.#.#...#.#.#.>.>...#.#.#.#...#.#...#...#...###
+#.#.###.#.#.#########.#.#.#.#####.#.#.#.#######.#.#############.#.#.#.###.#############.#.#####.#.#####.#.###v#####.#.#.#.#.#.###########.###
+#.#.....#.#.....#...#.#.#.#.....#.#.#...#...#...#.....#...#...#.#.#.#...#.#.......#.....#...#...#.#...#.#.###.....#.#.#...#...###...#...#...#
+#.#######.#####.#.#.#.#.#.#####.#.#.#####.#.#.#######.#.#.#.#.#.#.#.###.#.#.#####.#.#######.#.###.#.#.#.#.#######.#.#.###########.#.#.#.###.#
+#.......#.#.....#.#.#.#.#.#...#.#.#...#...#...#...###...#.#.#...#.#.#...#...#.....#.......#.#.#...#.#.#...#####...#...###...#...#.#.#.#.#...#
+#######.#.#.#####.#.#.#.#.#.#.#.#.###.#.#######.#.#######.#.#####.#.#.#######.###########.#.#.#.###.#.#########.#########.#.#.#.#.#.#.#.#.###
+#.......#.#.....#.#.#.#.#...#.#.#.#...#...#.....#.###...#.#.....#.#.#.......#.......#...#...#...###.#...#...#...#...###...#...#...#.#.#.#...#
+#.#######.#####.#.#.#.#.#####.#.#.#.#####.#.#####.###.#.#.#####.#.#.#######.#######.#.#.###########.###.#.#.#.###.#.###.###########.#.#.###.#
+#...#...#.......#.#.#.#.#...#.#...#...#...#.....#.....#...#.....#.#.#.......###.....#.#.###...#...#.#...#.#.#...#.#...#...........#.#.#...#.#
+###.#.#.#########.#.#.#.#.#.#v#######.#.#######.###########.#####.#.#.#########v#####.#.###.#.#.#.#.#.###.#.###v#.###.###########.#.#.###.#.#
+#...#.#...#.......#...#.#.#.>.>.#...#...###.....#.........#.....#.#.#.#...#...>.>.#...#...#.#.#.#...#...#.#.#.>.>.#...#...........#...#...#.#
+#.###.###.#.###########.#.###v#.#.#.#######.#####.#######.#####.#.#.#.#.#.#.###v#.#.#####.#.#.#.#######.#.#.#.#v###.###.###############.###.#
+#.....#...#...........#.#.#...#...#.......#.....#.#.......###...#.#.#.#.#...#...#...###...#.#.#.......#.#.#.#.#...#...#.....#.........#...#.#
+#######.#############.#.#.#.#############.#####.#.#.#########.###.#.#.#.#####.#########.###.#.#######.#.#.#.#.###.###.#####.#.#######.###.#.#
+#.......#...#...#.....#...#...#.....#.....#...#...#.....###...#...#.#...#...#.........#...#.#.#.......#...#...#...###...###...#.......###.#.#
+#.#######.#.#.#.#.###########.#.###.#.#####.#.#########.###.###.###.#####.#.#########.###.#.#.#.###############.#######.#######.#########.#.#
+#.......#.#.#.#.#.......#####.#...#...#.....#.#...###...#...###...#.#.....#.......#...###.#.#...###...#.......#.....###...#.....#...#...#...#
+#######.#.#.#.#.#######.#####.###.#####.#####.#.#.###.###.#######.#.#.###########.#.#####.#.#######.#.#.#####.#####.#####.#v#####.#.#.#.#####
+#.......#.#.#.#.#...#...#.....#...#...#.....#.#.#.#...###.....###...#...........#.#.#...#.#.#.......#.#.....#.#...#.....#.>.#...#.#...#.#...#
+#.#######.#.#.#.#.#.#.###.#####.###.#.#####.#.#.#.#.#########.#################.#.#.#.#.#.#.#.#######.#####.#.#.#.#####.###v#.#.#.#####.#.#.#
+#...#...#.#.#.#...#.#...#.....#.###.#.#...#.#.#.#.#...###...#.....#...........#.#.#...#.#...#.......#.......#...#.#...#.###...#...#...#.#.#.#
+###.#.#v#.#.#.#####.###.#####.#.###.#.#.#.#.#.#.#.###v###.#.#####.#.#########.#.#.#####.###########.#############.#.#.#.###########.#.#.#.#.#
+###...#.>.#...#...#.....#...#.#...#.#.#.#.#.#.#.#.#.>.>...#.......#.....#...#...#.#...#.....#.......#...........#...#...#...........#...#.#.#
+#######v#######.#.#######.#.#.###.#.#.#.#.#.#.#.#.#.#v#################.#.#.#####.#.#.#####.#.#######.#########.#########.###############.#.#
+#.....#.........#.#...#...#...###...#...#.#.#.#.#...#.#...###.........#.#.#.....#.#.#.#.....#...#...#.#.........###.......#...#...###...#.#.#
+#.###.###########.#.#.#.#################.#.#.#.#####.#.#.###.#######.#.#.#####.#.#.#.#.#######.#.#.#.#.###########.#######.#.#.#.###.#.#.#.#
+#...#.#...........#.#.#.#...#...#...#...#...#.#.....#...#...#...#.....#...#.....#...#...###...#...#...#...........#...#...#.#.#.#...#.#.#.#.#
+###.#.#.###########.#.#.#.#.#.#.#.#.#.#.#####.#####.#######.###.#.#########.###############.#.###################.###.#.#.#.#.#.###.#.#.#.#.#
+#...#.#.............#.#.#.#.#.#.#.#.#.#.#...#...#...###.....#...#...#...###.................#.###...#...#.........#...#.#.#.#...###...#...#.#
+#.###.###############.#.#.#.#.#.#.#.#.#.#.#.###.#.#####.#####.#####.#.#.#####################.###.#.#.#.#.#########.###.#.#.###############.#
+#...#.............#...#...#...#...#...#.#.#...#...#...#.#...#.....#...#...#.......#.....#...#.#...#...#.#.........#...#.#.#.#.............#.#
+###.#############.#.###################.#.###.#####.#.#.#.#.#####.#######.#.#####.#.###.#.#.#.#.#######.#########.###.#.#.#.#.###########.#.#
+###.#.....###...#...#...###...###...###...#...#...#.#.#.#.#.#.....#.......#.....#.#...#...#...#.......#...........###...#...#.#...#.....#.#.#
+###.#.###.###.#.#####.#.###.#.###.#.#######v###.#.#.#.#.#.#.#.#####.###########.#.###.###############.#######################.#.#.#.###.#.#.#
+#...#.#...#...#...#...#.#...#.....#.......>.>...#.#.#.#...#...#.....###...#.....#.....###...#...#.....#...#.......#...#...###...#...#...#...#
+#.###.#.###.#####.#.###.#.#################v#####.#.#.#########.#######.#.#.#############.#.#.#.#.#####.#.#.#####.#.#.#.#.###########.#######
+#...#.#...#...#...#.###.#...#...............#.....#.#.#...#...#.....###.#.#.....###...###.#.#.#.#.......#...#.....#.#.#.#...#...#...#.......#
+###.#.###v###.#.###.###.###.#.###############.#####.#.#.#.#.#.#####v###.#.#####v###.#.###.#.#.#.#############.#####.#.#.###.#.#.#.#.#######.#
+###...###.>...#.#...#...#...#.#...#...#.....#.....#.#.#.#...#.....>.>.#.#...#.>.>...#...#.#...#.#...#.........#.....#...#...#.#...#.###.....#
+#########v#####.#.###.###.###.#.#.#.#.#.###.#####.#.#.#.###########v#.#.###.#.#v#######.#.#####.#.#.#.#########.#########.###.#####.###.#####
+###...###.#...#...###...#.###.#.#...#...#...#.....#.#.#.#.......###.#.#.###...#.#.....#.#.#...#.#.#.#.........#.....#.....###.....#...#.....#
+###.#.###.#.#.#########.#.###.#.#########.###.#####.#.#.#.#####.###.#.#.#######.#.###.#.#.#.#.#.#.#.#########.#####.#.###########.###.#####.#
+#...#.....#.#.###...#...#...#...#.........###.....#.#...#.....#.#...#.#.#.......#.#...#...#.#...#.#.#...#.....#.....#.#...#...###...#.....#.#
+#.#########.#.###.#.#.#####.#####.###############.#.#########.#.#.###.#.#.#######.#.#######.#####.#.#.#.#.#####.#####.#.#.#.#.#####.#####.#.#
+#.#...#.....#...#.#.#...#...#...#.............###...#.......#.#.#...#.#.#...#...#.#.#...###.....#.#...#.#...###.#.....#.#.#.#.#...#.....#...#
+#.#.#.#.#######.#.#.###.#.###.#.#############.#######.#####.#.#.###.#.#.###.#.#.#.#.#.#.#######.#.#####.###.###.#.#####.#.#.#.#.#.#####v#####
+#...#...#.......#.#.###...###.#.#.............#.....#.#...#...#.....#...###.#.#.#.#...#.....#...#...#...#...#...#...#...#.#.#.#.#...#.>.#...#
+#########.#######.#.#########.#.#.#############.###.#.#.#.#################.#.#.#.#########.#.#####.#.###v###.#####.#.###.#.#.#.###.#.#v#.#.#
+#.........#.....#.#.....###...#.#...............#...#...#.#...............#.#.#.#.#...#.....#...#...#.#.>.>...#####...#...#.#.#...#...#...#.#
+#.#########.###.#.#####.###.###.#################.#######.#.#############.#.#.#.#.#.#.#.#######.#.###.#.#v#############.###.#.###.#########.#
+#...#...#...###...#.....#...#...#.................#.....#...###.......#...#.#.#...#.#...#######.#.###.#.#.......###...#.#...#.....###.......#
+###.#.#.#.#########.#####.###.###.#################.###.#######.#####.#.###.#.#####.###########.#.###.#.#######.###.#.#.#.###########.#######
+#...#.#.#.#.........###...#...###.........#...#...#...#.........#...#...###...#.....#.........#.#...#...#...#...#...#.#...#.....#...#.......#
+#.###.#.#.#.###########.###.#############.#.#.#.#.###.###########.#.###########.#####.#######.#.###.#####.#.#.###.###.#####.###.#.#.#######.#
+#.....#...#...........#...#.....#...#.....#.#.#.#...#.......#.....#...#...#...#.......#.......#.#...###...#...###...#.#...#...#.#.#...#.....#
+#####################.###.#####.#.#.#.#####.#.#.###.#######.#.#######.#.#.#.#.#########.#######.#.#####.###########.#.#.#.###v#.#.###.#.#####
+#.......###...........###.#.....#.#.#.....#.#.#.#...#.....#...#.....#.#.#...#...........###...#...#...#.........###.#.#.#.#.>.#...###.#...###
+#.#####.###.#############.#.#####.#.#####v#.#.#.#.###.###.#####.###.#.#.###################.#.#####.#.#########v###.#.#.#.#.#v#######.###.###
+#.#...#.....#.....#...#...#.#.....#...#.>.>.#.#.#...#.#...#.....###...#.......#.............#.#.....#.........>.>.#.#.#.#.#.#...#...#...#...#
+#.#.#.#######.###.#.#.#.###.#.#######.#.#v###.#.###.#.#.###.#################.#.#############.#.###############v#.#.#.#.#.#.###.#.#.###.###.#
+#.#.#...#...#.#...#.#...#...#.....###...#...#...#...#.#...#.......#...#...###...###...........#.......#.......#.#.#.#...#.#.###...#.###...#.#
+#.#.###.#.#.#.#.###.#####.#######.#########.#####.###.###.#######.#.#.#.#.#########.#################.#.#####.#.#.#.#####.#.#######.#####.#.#
+#...#...#.#.#.#...#.#...#...#...#.#.....#...#.....###.#...#.......#.#.#.#.....#...#.........#...#.....#.....#...#...###...#...#.....#...#...#
+#####.###.#.#.###.#.#.#.###.#.#.#.#.###.#.###.#######.#.###.#######.#.#.#####.#.#.#########.#.#.#.#########.###########.#####.#.#####.#.#####
+#...#...#.#...#...#...#...#...#...#...#.#...#.......#.#...#.......#.#.#.#.....#.#.#...#.....#.#.#.......###.....###.....#.....#.#.....#.....#
+#.#.###.#.#####.#########.###########.#.###.#######.#.###.#######.#.#.#.#.#####.#.#.#.#v#####.#.#######.#######.###.#####.#####.#.#########.#
+#.#...#...#.....#####...#...###...#...#...#.#.......#.#...#...#...#.#.#.#.#...#.#.#.#.>.>.#...#...#...#.#.....#...#.....#.#####.#.#.........#
+#.###.#####.#########.#.###.###.#.#.#####.#.#.#######.#.###.#.#v###.#.#.#.#.#.#.#.#.###v#.#.#####.#.#.#.#.###.###.#####.#.#####.#.#.#########
+#...#.#.....#...###...#.....#...#...#...#.#.#.....#...#.....#.>.>.#.#.#.#.#.#...#...###.#.#.#.....#.#...#...#.....#.....#...#...#.#...#...###
+###.#.#.#####.#v###.#########.#######.#.#.#.#####.#.###########v#.#.#.#.#.#.###########.#.#.#.#####.#######.#######.#######.#.###.###.#.#.###
+#...#...#.....#.>.#...#...###.....###.#.#...#.....#...#.......#.#...#...#...#.....#.....#...#.....#...#...#.......#.#...#...#...#.###...#...#
+#.#######.#####v#.###.#.#.#######.###.#.#####.#######.#.#####.#.#############.###.#.#############.###.#.#.#######.#.#.#.#.#####.#.#########.#
+#.........#...#.#.#...#.#.....###.....#.....#.#...#...#.....#.#...........###...#.#...........#...#...#.#.........#.#.#...#####...#...#.....#
+###########.#.#.#.#.###.#####.#############.#.#.#.#.#######.#.###########.#####.#.###########.#.###.###.###########.#.#############.#.#.#####
+#...###.....#...#...###.....#.###...........#...#...###.....#.............#...#.#.....#.......#.....###...........#...###...#...#...#...#####
+#.#.###.###################.#.###.#####################.###################.#.#.#####.#.#########################.#######.#.#.#.#.###########
+#.#...#...................#.#...#.......#...#.....#...#...............#.....#...#.....#...........#...............###...#.#.#.#...#.........#
+#.###.###################.#.###.#######.#.#.#.###.#.#.###############.#.#########.###############.#.#################.#.#.#.#.#####.#######.#
+#...#.#...###.........#...#...#...#.....#.#.#.#...#.#.#...#...#.....#.#.........#.....#.....#.....#...........#...#...#...#.#.......###...#.#
+###.#.#.#.###.#######.#.#####.###.#.#####.#.#.#.###.#.#.#.#.#.#.###.#.#########.#####.#.###.#.###############.#.#.#.#######.###########.#.#.#
+#...#...#.....#.....#...###...###...#.....#...#.#...#...#...#.#...#...#...#####.....#.#...#.#.....###.........#.#...#.......#...........#...#
+#.#############.###.#######.#########.#########.#.###########.###.#####.#.#########.#.###.#.#####.###.#########.#####.#######.###############
+#.....#.....#...#...#.....#.....#.....#...#.....#.#.....#...#.....###...#.#.........#.....#...#...#...#.........#...#...#.....#.............#
+#####.#.###.#.###v###.###.#####.#.#####.#.#.#####.#.###.#.#.#########.###.#.#################.#.###.###.#########.#.###.#.#####.###########.#
+#...#...###...###.>.#...#.###...#.#...#.#.#.#...#...###...#.........#...#.#.........#.....###...###.....###.....#.#.....#.......###.......#.#
+#.#.#############v#.###.#.###v###.#.#.#.#.#.#.#.###################.###.#.#########.#.###.#################.###.#.#################.#####.#.#
+#.#.#...#.........#...#.#.#.>.>...#.#...#...#.#.#.......#...........#...#...#.......#.#...#...#...#...#.....###...#...#.....#...#...#...#...#
+#.#.#.#.#.###########.#.#.#.#v#####.#########.#.#.#####.#.###########.#####.#.#######.#.###.#.#.#.#.#.#.###########.#.#.###.#.#.#.###.#.#####
+#.#.#.#.#.......#####.#.#.#.#.#...#.#...#...#.#.#.....#.#...........#.....#.#.......#.#...#.#...#...#.#...........#.#.#...#.#.#.#...#.#.....#
+#.#.#.#.#######.#####.#.#.#.#.#.#.#.#.#.#.#.#.#.#####.#.###########.#####.#.#######.#.###.#.#########.###########.#.#.###.#.#.#.###.#.#####.#
+#.#...#.#...###.....#.#.#.#.#.#.#...#.#.#.#...#.#...#.#.#...........#...#.#.###.....#.#...#...#.......#...#.......#.#...#.#.#.#...#...#...#.#
+#.#####.#.#.#######.#.#.#.#.#.#.#####.#.#.#####.#.#.#.#.#.###########.#.#.#.###v#####.#.#####.#.#######.#.#v#######.###.#.#.#.###.#####.#.#.#
+#.....#.#.#.#.....#.#...#...#.#.#...#.#.#.#.....#.#.#.#.#...###.....#.#...#.#.>.>...#.#.#...#.#...#.....#.>.>...###.#...#.#.#.#...#...#.#.#.#
+#####.#.#.#.#.###.#.#########.#.#.#.#.#.#.#.#####.#.#.#.###v###.###.#.#####.#.#v###.#.#.#.#.#.###.#.#######v###.###.#.###.#.#.#.###.#.#v#.#.#
+#.....#...#.#.###.#...###.....#.#.#.#.#.#.#.#...#.#.#.#...>.>...###.#.....#.#.#...#...#.#.#.#.###...###...#.###...#.#.#...#.#.#.#...#.>.#...#
+#.#########.#.###.###.###.#####.#.#.#.#.#.#.#.#.#.#.#.#####v#######.#####.#.#.###.#####.#.#.#.#########.#.#.#####.#.#.#.###.#.#.#.#####v#####
+#.#...#...#.#...#...#.#...#...#...#...#...#.#.#.#.#.#.#.....#...###...#...#.#...#.....#.#.#.#.#.....#...#...#.....#.#.#.###.#.#...#...#.#...#
+#.#.#.#.#.#.###.###.#.#.###.#.#############.#.#.#.#.#.#.#####.#.#####.#.###.###.#####.#.#.#.#.#.###.#.#######.#####.#.#.###.#.#####.#.#.#.#.#
+#...#...#.#.#...###...#...#.#...#...#...###...#.#.#.#.#.#.....#.....#.#.###.....#.....#...#...#...#.#.......#.......#.#.###...#...#.#.#...#.#
+#########.#.#.###########.#.###.#.#.#.#.#######.#.#.#.#.#.#########.#.#.#########.###############.#.#######.#########.#.#######.#.#.#.#####.#
+#.........#...###...###...#.###...#...#.......#.#.#...#...#.....#...#.#.###...###.............###.#.........###.....#...#...###.#...#.......#
+#.###############.#.###.###.#################.#.#.#########.###.#.###.#.###.#.###############.###.#############.###.#####.#.###.#############
+#...............#.#...#.....#.................#...###.......###.#...#.#.#...#.#...............#...#...#...###...#...###...#...#.............#
+###############.#.###.#######.#######################.#########.###.#.#.#.###.#.###############.###.#.#.#.###.###.#####.#####.#############.#
+###.............#.#...###...#.......#...#...#.......#.........#.#...#...#...#.#.............###.#...#.#.#...#.#...#...#...#...#.......#.....#
+###.#############.#.#####.#.#######.#.#.#.#.#.#####.#########.#.#.#########.#.#############.###.#.###v#.###.#.#.###.#.###.#.###.#####.#.#####
+#...#.....#...###.#.#...#.#.#...###.#.#.#.#...#.....#.........#...###...#...#.............#...#...#.>.>.#...#.#...#.#.#...#...#.....#.#.....#
+#.###.###.#.#.###.#.#.#.#.#.#.#.###v#.#.#.#####.#####.###############.#.#.###############.###.#####.#####.###.###.#.#.#.#####.#####.#.#####.#
+#.#...#...#.#.#...#.#.#.#.#.#.#.#.>.>.#...#.....#...#...........###...#.#...#...........#.....###...#.....###...#.#.#.#...#...#...#.#.#...#.#
+#.#.###.###.#.#.###.#.#.#.#.#.#.#.#########.#####.#.###########.###.###.###.#.#########.#########.###.#########.#.#.#.###.#.###.#.#.#.#v#.#.#
+#.#.#...#...#.#...#.#.#.#.#.#.#.#.#.........#...#.#...#.........#...#...###...#.........###...#...###...#.....#.#.#.#...#.#...#.#.#.#.>.#...#
+#.#.#.###.###.###.#.#.#.#.#.#.#.#.#.#########.#.#.###.#.#########.###.#########.###########.#.#.#######.#.###.#.#.#.###.#.###.#.#.#.###v#####
+#.#.#...#.###...#.#.#.#.#.#...#...#.........#.#.#.#...#.........#...#.#...#...#.........#...#.#.....#...#.###.#.#.#.#...#.###...#.#.###.....#
+#.#.###.#.#####.#.#.#.#.#.#################.#.#.#.#.###########.###.#.#.#.#.#.#########.#.###.#####.#.###.###.#.#.#.#.###.#######.#.#######.#
+#...###.#.#.....#.#...#.#.......#...........#.#.#.#...#...#.....###.#.#.#.#.#.#.....#...#...#.#.....#...#.###.#.#...#...#.#.......#...#.....#
+#######.#.#.#####.#####.#######.#.###########.#.#.###.#.#.#.#######.#.#.#.#.#.#.###.#.#####.#.#.#######.#.###.#.#######.#.#.#########.#.#####
+#.......#.#.#...#.....#...#.....#.......#...#.#.#...#.#.#.#.#...###.#.#.#.#.#.#...#.#.#...#.#.#.....#...#.#...#...#.....#.#...#...#...#.#...#
+#.#######.#.#.#.#####.###.#.###########.#.#.#.#.###.#.#.#.#v#.#.###.#.#.#.#.#.###.#.#v#.#.#.#.#####.#.###.#.#####.#.#####.###.#.#.#.###.#.#.#
+#.#...#...#.#.#.#.....###.#.#...........#.#.#.#...#.#.#.#.>.>.#.#...#.#.#.#.#.#...#.>.>.#.#.#.#...#.#...#.#...#...#.#...#.#...#.#.#.#...#.#.#
+#.#.#.#.###.#.#.#.#######.#.#.###########.#.#.###.#.#.#.#######.#.###.#.#.#.#.#.#########.#.#.#.#.#.###.#.###.#.###.#.#.#.#.###.#.#.#.###.#.#
+#...#...###...#...#######...#.............#...###...#...#######...###...#...#...#########...#...#...###...###...###...#...#.....#...#.....#.#
+###########################################################################################################################################.#
diff --git a/2023/src/bin/day_23.rs b/2023/src/bin/day_23.rs
index b3a610b..3a2bd48 100644
--- a/2023/src/bin/day_23.rs
+++ b/2023/src/bin/day_23.rs
@@ -1,19 +1,51 @@
-use nom::IResult;
+use nom::{
+ branch::alt,
+ character::complete::{char, line_ending},
+ combinator::{map, value},
+ multi::{many1, separated_list1},
+ IResult,
+};
use std::fs;
fn main() -> Result<(), Box<dyn std::error::Error>> {
- let input = fs::read_to_string("inputs/day_2.txt")?;
- let parsed = Example::parser(&input).unwrap().1;
+ let input = fs::read_to_string("inputs/day_23.txt")?;
+ let parsed = ForestMap::parser(&input).unwrap().1;
dbg!(&parsed);
Ok(())
}
#[derive(Debug)]
-struct Example;
+struct ForestMap(Vec<Vec<ForestTile>>);
-impl Example {
- fn parser(_input: &str) -> IResult<&str, Self> {
- todo!()
+#[derive(Debug, Clone)]
+enum ForestTile {
+ Wall,
+ Open,
+ SlopeUp,
+ SlopeDown,
+ SlopeLeft,
+ SlopeRight,
+}
+
+impl ForestMap {
+ fn parser(input: &str) -> IResult<&str, Self> {
+ map(
+ separated_list1(line_ending, many1(ForestTile::parser)),
+ ForestMap,
+ )(input)
+ }
+}
+
+impl ForestTile {
+ fn parser(input: &str) -> IResult<&str, Self> {
+ alt((
+ value(ForestTile::Wall, char('#')),
+ value(ForestTile::Open, char('.')),
+ value(ForestTile::SlopeUp, char('^')),
+ value(ForestTile::SlopeDown, char('v')),
+ value(ForestTile::SlopeLeft, char('<')),
+ value(ForestTile::SlopeRight, char('>')),
+ ))(input)
}
}