diff --git a/day16/input b/day16/input new file mode 100644 index 0000000..54bcfc6 --- /dev/null +++ b/day16/input @@ -0,0 +1,141 @@ +############################################################################################################################################# +#.......................#.....#...........#.......#...........#...#.....#.......#...#.........#.......#.#.................#...........#....E# +#.#.#.#.#.#.#.###.#.###.#.#.###.#####.###.#####.###.###.#.#.#.#.#.#.#.#.#####.#.#.###.#.#####.#.#####.#.#.#######.#.#####.#.###.#######.#.#.# +#.#.#.#.#.#.#...#.#.#.....#.#.......#...#.......#...#.#.........#.#.#.#.......#.#.....#...#.#.#.#...#.#.#.......#...#...#.#...#.........#.#.# +#.#.#.#.#.#.###.#.#.#####.#.#.#######.#.#####.###.#.#.#.#.###.#.###.#.#######.#.#########.#.#.#.#.###.#.#####.#.###.###.#.#.#######.#####.#.# +#.#.#.#.#...#.#.#.#.......#.....#...#.#.#.....#...#...#.#...#...#...#.....#...#...#...#...#.#...#.....#.#.........#...#.#.....#...#.....#...# +#.#.#.#.###.#.#.#.###.#.#.#######.#.###.#######.###.###.#.#.#####.###.###.#.#####.#.#.#.###.#####.#####.#.###.#######.#.###.#.#.#.#########.# +#.....................#...........#...#.#...#...#.....#...#.#.....#...#.#.#.....#.#.#...#.......#.....#...#.#.......#.#.....#...#.#...#...#.# +#.###.#.#.#.#.#####.###########.#####.#.#.#.#.###.#.#.#####.#.#####.#.#.#.#####.#.#.#####.#####.#####.###.#.#.#####.#.#.#########.#.#.#.#.#.# +#.#...#...#...#...#...#.........#.......#.........#...#...#...#.....#...#.....#.#.#...#.....#...#...#...#.#...................#.#...#.#.#.#.# +#.#.###.#####.#.#####.#.#######.#.#######.#########.#.#.#######.###.###.#####.#.#.###.#.###.#.###.#####.#.#.#.#.###########.#.#.#####.#.#.#.# +#.#.#...#...#.#.#.....#...#...#.#.#.......#.......#.#.#.....#.#...#.#...#...#.#.......#.#...#.....#.....#...#.......#.................#.#.#.# +#.#.#.###.#.#.#.#.#.#####.#.#.#.###.#######.###.#.#.#.#.#.#.#.#.###.#.#####.#.###########.#########.#######.#.#####.#.#########.###.#.#.#.#.# +#.#.#...#.#...#.#.#.#.....#.#...#...#.....#...#.#.#.#.#.#.#.#...#...............#.......#.#...#.....#.....#.......#.#.......#.#.....#.#.#...# +#.#.###.#.#####.#.###.###.#.#####.###.#.#.#.###.#.#.#.#.#.#.#####.###.#.#######.###.#.#.#.#.#.#.#####.###.###.#####.#.#####.#.#####.#.#.###.# +#.#...#...#.....#.......#...#.....#...#.#.#.#...#...#.#.#.#.......#.#.#.#.....#...#.#.#.#.#.#.........#.............#.#.....#...............# +#.###.#######.#.#########.#.#.#####.###.###.#.#######.###.#########.#.#.#.###.###.#.#.#.#.#.#####.#####.#############.#.#####.###.#.#####.#.# +#.....#...#...#.#.#.......#...#...#...#.....#.....#.#.....#.#...........#.#.#.#...#.#.#.#.#.#.....#...#.......#.......#.#...#.....#.........# +#.#####.#.#.#.#.#.#.#######.#.#.#####.#########.#.#.#######.#.###.#####.#.#.#.#.###.#.#.#.#.#.#####.#.#.#####.#.#######.#.###.#.###.###.#.#.# +#.......#...#...#.#.#...#...#.#.........#.....#.#.#.....#.....#...#...#.#.#...#...#.#.#...#.#.#...#.#.#.#...#...#.......#.....#.........#.#.# +#.#.#########.#.#.#.#.#.#.###.#####.#.###.###.###.#.#####.#####.#.#.#.###.#.#####.#.#.###.#.#.#.#.#.#.#.###.#####.#######.#.###########.#.#.# +#.#.....#.....#...#.#.#.#.....#.....#.#...#.......#.#.....#.....#.#.#...#.#.....#.#.#.#...#.#.#.#.#.#.............#.....#...#...............# +#.###.#.#.###.###.#.#.#.###.###.#####.#.#.#########.#.#######.###.#.###.#.#####.#.###.#####.#.###.#.#########.#####.###.#.#.#.#.###.#.#.###.# +#...#.#.#.........#...#.#...#...#...#.#.....#.......#...#...#.#...#...#.#...#.#.#...#...#...#.#...#.....#.....#.......#...#.#.#...#...#.....# +###.###.#####.#########.#.###.#.#.#.#.#####.#.#########.#.#.#.#.#####.#.###.#.#.###.#.#.#.###.#.#####.###.###########.#####.#.###.#####.#.#.# +#.......#.......#...#...#.#...#.#.#...#.....#.........#...#.#...#...#.#.....#.#.#...#.#...#...#.......#...#...........#...#.....#.........#.# +#########.###.#.#.#.#.###.#.###.#.#####.#####.#######.#####.#.#.###.#.#######.#.#.###.#####.###.#.#.###.#####.#########.#.#####.#######.###.# +#.........#...#.....#...#.#...#...#.....#.....#...........#.#.#.....#...#.....#...#...#.....#...#.#...#.....#.#...#...........#.#.....#...#.# +#.#########.#.#####.###.#.###.#####.#####.#########.#.###.#.#.#####.###.#.#.#.#####.#####.###.###.#.#####.#.#.#.#.#.#.###.#.###.#.#.#.#.#.#.# +#.#.......#.#...#...#...#.#.....#...#.....#.#.......#...#.#.#...#...#.....#.....#...#.....#.....#...#...#.#.#.#.#.........#.#...#.#.#.#.#.#.# +#.###.#####.#.#.#.###.#.#.#.#####.###.#####.#.#.###.###.###.###.#.###.###.###.#.#.#.###.###.#.#######.#.#.#.#.#.#######.###.#.#####.#.#.#.#.# +#...#.#.....#...#.#...#.#.#...#...#.#.#...#...#...#...#.....#...#...#...#.#.#.#...#.#...#...#.#.......#.#.#.....#...#...#...#.#.....#.#.#...# +###.#.#.###.#.###.#.###.#.#####.###.#.#.#.###.###.###.#######.#########.#.#.#.#####.#.#.###.#.#.#######.#.#.#####.#.#.###.#.#.###.###.#.##### +#.............#...#.#...#.....#...#.....#...#.#...#...#.......#.........#...#.......#.....#...#...#.#...#.#.......#.#.....#.#.....#...#.#...# +#.###.###.#.###.###.#.#######.#.#.#.#######.#.#.###.###.###.#.#.###########.#############.#######.#.#.#############.#.#.#.#.#####.#####.#.#.# +#...#...#.#...#.#...#...#.....#.#.#.#...#...#.#...#.#.#.#...#.#.#.#.....#...#.......#.....#.....#.#.#.#.....#.....#.#.#...#.....#.#.....#.#.# +#.#.###.#.#.#.#.#.#######.#####.#.###.#.#.###.###.#.#.#.#.#####.#.#.###.#.#####.###.#.#####.###.#.#.#.###.#.#.###.#.#.#########.#.#.###.#.#.# +#.#.#...#...#.#.#.......#...#...#.....#.#...#.#.#.#.#...#.....#.#...#.#...#...#.......#.....#.#...#.#.....#...#...#.#...#.....#...#.#.....#.# +###.#.#.#.###.#.#######.###.#######.###.###.#.#.#.#.###.#####.#.###.#.#####.#.#.#######.#####.#####.###########.###.###.###.#####.#.#.#####.# +#...#.....#...#.#.....#...#.#.....#.#...#...#...#.#...#.......#...#.........#.#...#.........#...#.......#.....#.#...#...#...#.....#.#.#...#.# +#.#####.#.#.###.#.###.#.#.#.#.###.#.#.###.#####.#.###.#.#########.###########.###.#########.#.###.###.#.#.###.#.#.#.#.###.###.###.#.###.#.#.# +#.#...#...#.#...#.#.....#.#...#.#.#.#.#...#.....#.#.#.#.........#.....#.....#...#...#...#...#.........#.#.#...#.....#.#.#.....#...#...#.#.#.# +#.#.#.#.#.#.#.###.#######.#####.#.###.#.#########.#.#.#######.#.#####.#.###.###.###.#.#.#.###########.###.#.#########.#.#.#####.#####.#.#.#.# +#...#.#...#...#.......#...#.....#.#...#.#...........................#.#...#...#.....#.#...#.........#.....#.#.........#...#.#...#...#...#...# +#.###.#.#.#####.#####.#.###.###.#.#.###.#.#########################.#.###.###.#####.#.#####.#######.#######.#.#######.###.#.#.#.#.#.#######.# +#.......#.......#.....#.#...#.#.#.#...#...#...#.....#.....#.....#...#...#.#...#.............#.....#.#...#...#...........#...#.#.#.#.......#.# +#.#.###.#####.#.#.#####.#.###.#.#.#.#.#####.#.#.###.#.#.#.#.###.#.###.###.#.###.#######.#####.#.###.#.#.#.#####.#######.#####.###.###.#.###.# +#.....#.#.....#.#.#...#.#.....#...#.#.......#.....#...#.#.....#...#.......#...#...#...#.....#.#.#...#.#.#.#.....#...#...#...#.....#...#.#...# +#.#####.#.#####.#.#.#.#.#####.#######.###############.#############.###.#####.#####.#.#####.###.#.###.#.#.#.#####.#.#.###.#.#######.#####.### +#...#...#.#...#.#.#.#...#...#.#.....#.#...............#...........#.....#...#.#...#.....#.....#.#...#.#...#...#...#.#.....#.#...#...#...#...# +#.#.#.#.#.#.#.###.#.#####.###.###.#.###.#########.#.###.#########.#######.#.#.#.#.#.###.#####.#.###.#.#######.#.###.#######.#.#.#.###.#.###.# +#.....#.....#...#.......#...#.....#.#...#.........#.#...#.....#.....#.....#.#...#.#...#.#...#...#...#.........#...#.....#.....#.#.#...#.....# +#.#####.#######.#.#####.#.#.#######.#.###.#####.###.#.#####.#.#.###.#.#####.#####.###.#.#.#.###.#.#####.###.#.###.#####.#######.#.#.######### +#.........#...#.#.....#.#.#.....#.#.#...#...#...#...#.#.....#.#...#...#.........#.....#...#.#.#.#...#.....#.#...#.#...#...#.#.....#.#.......# +#.#####.#.###.#.#####.#.###.###.#.#.###.#.#.#.#####.#.###.#.#####.#############.###.#####.#.#.#.###.#.###.#.#.###.###.###.#.#.#####.###.###.# +#.#.......#...#.#.....#...........#.....#.#...#.....#.....#.#...#.#.......#...#...........#.#.....#.......#...#.........#.#.....#...#...#...# +#.#.#######.###.#.###########.###########.###.#.###.###.#.#.#.#.#.#.#####.###.#.#.#######.#.#####.#######.#####.#########.#######.###.###.### +#.#...#...........#...#.......#...........#.#.....#...#...#.#.#...#...#.#...#...#.......#.#...#...#.....#.......#...#...#.........#.....#.#.# +#.###.#############.#.#.#######.#######.###.#.###.###.#####.#.#######.#.###.#####.#####.#####.#.###.###.###.#####.#.#.#.#.#############.#.#.# +#...#.#.........#...#.#...#.#...#.....#...#...#.#...#.#...#.#.......#...#...#.....#...#.......#...#...#...#...#...#...#.#.#.............#.#.# +#.#.#.#.#######.#.###.###.#.#.###.###.###.#.###.###.###.#.#.#####.###.###.#.#.#####.#.###########.###.###.###.#.#######.#.#.#.#.#########.#.# +#...#...#.....#.#...#.......#.#...........#.#.....#.....#...#...#.....#...#.#.#.#...#...........#.#.#...#.#...#...#...#.#.#...#...#.....#...# +#.#######.#.###.#.#.#.#######.#.#.#####.###.#.###########.###.#.#######.###.#.#.#.#.#############.#.#.#.#.#.#####.#.###.#.#.#####.#.#.#####.# +#...#.....#...#.#.#...#.......#.#.#...#.....#.#.........#...#.#.........#...#.#.#.#.......#...#.......#.#.#.#.....#.#...#.#.....#.#.#.......# +###.#.#######.#.#######.#######.###.#.#.#####.#.#.#####.#####.#########.#####.#.#.#####.#.#.#.#.#######.#.###.#.###.#.#.#.#######.#.######### +#.#.#...#.....#.......#.....#.....#.#...#.....#.#.#...........#.....#...#...#.#...#...#.#...#.....#.....#.....#.....#...#.......#.#.....#...# +#.#.#####.#########.#.#####.#.###.#.#####.###.#.#.#.#.#.#######.#####.#.#.#.#.#.###.#.#.###########.#############.#.###.#######.#.#####.###.# +#.#.....#.#.......#.#...#...#.#.#.#.#.....#...#.#.#.#.#...#...........#.#.#...#.#...#.#...#.....#...#.....#.......#...#.....#.#.............# +#.#####.#.#.#.#.#.#####.#.###.#.#.#.#.#####.###.###.#.###.#.###########.#.#######.###.#.#.#.###.#.###.#####.#.###.###.#####.#.#######.###.#.# +#.#.....#...#...#...#...#.#...#.#.#.#...#.#...#.....#...#...#...........#.........#.#...#.#.#.#.#.#...#.....#.#...........#.#.......#.#...#.# +#.#.#########.#.###.#.###.#.###.#.#.###.#.###.#######.#.#.###.###############.#####.###.###.#.#.#.#.#.#.#####.#.#.#########.###.###.#.#.###.# +#.#.#.......#.#.#.....#...#.....#.#.....#...#.#.....#.#.#.#.......#.....#...#.....#...#.....#.#...#.#.......#.#...#...#.....#...#.#...#.#...# +#.#.###.###.#.#.###.###.#######.#.#######.#.#.#.###.#.#.#.#######.#.#####.#.#.#.#.#.#.#######.#######.#####.#.#.###.#.#.#####.###.###.#.###.# +#...#...#.#...#...#...#.......#.#.#.......#.#.#...#.#.#.#.#...#...#.......#.#.#.#...#.....#.....#...#.....#.#.#.#...#...#.#.................# +#.###.###.###.###.#.#.#######.###.#.#####.###.###.#.###.#.#.#.#.#.#########.#.#.#####.###.###.#.#.#.###.#.###.#.#.###.#.#.#.#.#########.#.#.# +#.#...#.........#...#...#...#.#...#.....#.#.....#.#.#...#.#.#.#.#.....#.......#...#...#...#...#...#.....#.#...#...#.#.#.#...#.........#...#.# +#.#.###.###.#.#.#######.#.#.#.#.#####.#.#.#.#####.#.#.###.#.#.#.#.#####.#####.#.#.###.#.###.#############.#.#######.#.#.#.###########.#####.# +#.....................#.#.#...#.....#...#...#...#.#.#.#.#.#.#...#.#...#.#.#...#.#.......#.......#.........#...#.......#.#...#.......#...#...# +#######.#.#.###.#.###.#.#.#####.#.###.#######.#.#.#.#.#.#.#.###.###.#.#.#.#.###.#.#.#.#.###.#.#.#.###########.#.#######.###.#####.###.#.#.### +#.......#...#...#.#...#.#.#...#.......#...#...#.#.#.#.#...#...#.#...#...#...#...#.#.#.#...#.#.#...#...#.......#...#.....#.#.................# +#.#.#####.###.###.###.#.#.#.###.#######.#.#.###.#.#.#.###.###.#.#.#######.#######.#.#.###.#.#.#.###.#.#.#.#.###.###.#####.#.#.#.#.#.#######.# +#.#.#...............#...#.#...#.#.......#.#...#.#.#.#...#...#.#.#.#...#...#.......#.#.#...#.#.#...#.#.#...#...#.#...#.......#.#.#.#.....#...# +#.#.#.#.#######.###.###.#.#.#.#.#.#####.#.#.#.#.#.#.###.###.#.#.#.#.###.###.#.#####.#.#.#####.###.#.#.#####.#.#.#.#######.#.#.#.#.#####.#.### +#.............#...#.#...#.#.#...#...#...#.#.#.#...#.....#.....#.#.#...#...#.....#...#.#...#...#...#.#.......#...#.#.........#.#.....#...#...# +#.#.#.#.#.#.#.###.#.#.###.#.#######.#.#.#.###.#.#########.#######.#.#.###.#.###.###.#####.#.###.###.#############.#.###.###.#.#.#####.#.###.# +#.................#.#...#.#.......#.#.#.#.#...#.#.......#...#.....#.#...#.#...#.#...#...#.#.#...#...#.............#.....#...#.....#...#...#.# +#.#.#######.###.###.###.#.#####.###.#.#.#.#.###.#.#####.#.#.#.#########.#.#.###.#.###.#.#.#.#.#.###.#.#############.###.#.###.###.#.#####.#.# +#.....#...#...#.#...#...#.#.....#...#.#.#.#.#...#.#...#...#.#.#.........#.#.#...#.....#.#...#...#...#.....#...#...#.#.#...#.......#.#.....#.# +#.###.#.#####.#.#.#######.#.###.#.###.###.#.#####.###.###.#.#.#.###.#####.#.#.###.#####.#######.#.#.#####.###.#.#.#.#.#########.###.#.#####.# +#.#...#.....#...#.#.....#...#...#...#.....#.#...#.#...#...#.#.#...#...#...#.#...#.#...#.......#...#.....#...#.#.#...#.#.......#...#.#.#.....# +#.#.###.#.#######.#.###.#####.###.#.#.#####.#.#.#.#.#.#.#.###.#.###.#.#.#####.#.#.#.#.#######.###.###.#####.#.#.#####.#.#.###.#.#.#.###.##### +#...#...#...#.....#...#.......#...#.#.#.....#.#...#.#.#.#.#...#...#.#.......#.#.#.#.#.......#...#.#.........#.#.#.#.....#...#.#.#.#.....#...# +#.#######.#.#.###.###.###.#########.#.#.###.#.#####.#.#.#.#.###.#.#########.###.#.#####.#.#.#.###.#.#########.#.#.#.#######.#.###.#########.# +#.......#.#.#.#.....#.#...........#.#.#.#...#.#.....#.#.#.#.#...#.......#.......#.......#...#...#.#.#.........#.#.#.#.....#.#.....#.......#.# +#.#####.###.#.#####.#.###.###.###.#.#.#.#####.#.#.###.#.###.###.#######.#############.#.###.###.#.#.#####.#####.#.#.#.#####.#####.#####.#.#.# +#.....#.#...#.....#.#...#.#...#.....#.#...#...#.#...#.#.....#...#.......#.......#.......#.....#...#.....#.#...#.#.#.#.#.................#.#.# +#.###.#.#.#.#####.#.###.###.#####.###.#.#.#.###.#.#.#.#######.###.#######.#####.#########.###.#########.#.#.#.#.#.#.#.#.#################.#.# +#.....#.#.#...#.#.#...#.....#.....#...#.#.#.#...#...#.........#.#...#...#...#...................#.....#.#...#...#.#...#.#.......#.....#...#.# +#.###.#.#.###.#.#.#########.#.###.###.#.#.#.#.###.#############.###.###.#.#.#########.###########.###.#.###.#####.###.#.#.#####.#####.#.###.# +#.....#.#.#.#.#.#.#.....#...#.#.#...#...#.#.#.#...........#.......#...#...#...#...#.#...#.........#.#.#...#...#.......#.............#.#.#...# +#.#.#.#.#.#.#.#.#.#.#.###.###.#.###.###.#.#.###.###.###.#.###.###.###.#######.#.#.#.###.#.#####.#.#.#.#.#.###.#####################.#.#.###.# +#.#.#...#.#.....#...#.....#.#...#.#...#...#...#.........#.....#.....#.......#.#.#...#...#.#...#.....#.#.#.#.#.........#.....#...#...#.#.....# +#.###.###.#################.###.#.###.#######.#######.###.#.#####.#########.#.#.#####.###.#.#######.#.###.#.#########.#.###.#.#.#.###.#####.# +#.....#.......#...........#.#...#...#...#.....#.....#.#...#.#...#.#.....#.#...........#...#.........#.....#.........#...#.#...#...#...#.....# +#.###.#######.#.#####.###.#.#.###.#.###.#.###.#.###.#.#.###.#.#.###.#.#.#.#####.#.#####.#####.###.#.#######.###.#########.#########.#.#.##### +#...............#.#...#.......#.#.#...#...#.....#...#.#...#...#.....#.#.#.....#.#.....#.....#.#...#.........#...#.......#.....#.....#.#...#.# +#####.#####.#.###.#.###.#####.#.#.###.###.#.#######.#####.###########.#.###.#.#.###.#.#####.#.#.#####.#######.###.###.###.###.#.###.#####.#.# +#.......#...#.#...#.#...#.....#.....#.#.....#.....#.......#...........#.#...#.#...#.#.......#.#...#...#...#...#...#.#.....#.#...#.#.....#.#.# +#.###.#.#.###.#.###.#.###.#####.###.#.#.#.###.###.#########.###########.#.#######.#.#########.###.#.###.#.#.###.###.#######.#####.#####.#.#.# +#...#.#.#...#.#.#...#...#.#.....#...#...#.....#.#.....#.........#...#.#.#.#.......#...#.#.....#...#...#.#.#.....#.....#.......#...#.....#.#.# +#.#.#.#.###.#.#.#.#####.#.###.###.#######.#####.#####.#.#.#####.#.#.#.#.#.#.#######.#.#.#.#####.#####.#.#.#####.#.###.#.#.#####.#.#.###.#.#.# +#.#.#...#...#.#.#.#.....#...#...#.#.....#.#.........#...#.....#...#.#.#.#.#.#.....#.#.#.#...#.#.#.....#.#.......#...#...#.#.....#.#...#.#...# +#.#.#####.###.#.#.#########.#.#.#.#.###.#.#####.#.#.###.###########.#.#.#.#.#.###.###.#.###.#.#.#######.###########.#####.#.#####.###.#####.# +#.#.......#.....#.....#...#.#.#...#.#...#.#...#.#.#.#...#...#...#...........#...#.#...#.....#.#.#.....#...........#.....#.#...#.....#...#...# +#.#########.#########.#.#.#.#######.#.###.#.#.###.###.###.#.#.#.#.#########.###.#.#.#####.###.#.#.###.#####.#.#.#######.#.###.#.#######.#.### +#.........#.#.#.....#...#...........#.#.....#...#.#...#...#...#.#.#.........#...#...#...#...#.#...#.#.....#.#.#.....#...#.....#.....#...#.#.# +###.#.#####.#.#.###.#####.###########.#########.#.#.###.#####.#.#.#.#########.#######.#.###.#.#####.#####.#.#.###.###.#############.#.#.#.#.# +#.#.#.#.....#.#.#.#.......#.........#.....#.......#.#.#...#.....#.#.#...#.........#...#.#.....#.....#.....#.#...#.........#...............#.# +#.#.#.#.#####.#.#.#######.#.#####.#######.#######.#.#.#.#.#.#.#.#.#.###.#.#######.#.###.#####.###.#.#.#####.#.#########.###.#####.#.#.###.#.# +#...#.........#.#...#...#.#...#...#.....#...........#.#.#.#.#.#...#.#...#.#.....#...#.#.....#.#...#.#.......#.#.....#...#...#...#.#.#...#.#.# +#.###########.#.#.#.#.#.#.#.#.#####.###.#############.#.#.#.#.#.###.#.###.#.#.#######.#####.#.#.###.#######.###.###.#####.###.###.#.###.#.#.# +#.....#.....#...#.#...#...#.#.........#.............#...#.#.#...#...#.#...#.#...........#...#...#...#.............#.#.....#.....#.#...#...#.# +#####.#.#.###.#.###.#.#####.#########.#####.#######.#####.#.#####.###.#.###.#####.#####.#.#######.#.#.#########.#.#.#.#####.###.#.###.#####.# +#...#.#.#.....#...#.#.....#...#...#...#.....#.....#.#...#.#...#...#.....#...#.....#.#...#...#...#.........#.......#.#.....#.#...#.#.......#.# +#.###.#########.#.#.#####.#.###.#.#####.#########.#.#.#.#.#####.###.#####.###.#####.#.#####.###.###.###.#.###.#####.#.###.###.#.#.#.#####.#.# +#...#.........#.#.#.....#.#.#...#.#...#.#.......#.#...#.#.#.....#...#.....#...#.......#...#.#.....#.#...#.#...#.....#.#...#...#.#...#...#.#.# +#.#.#########.#.#.#.#####.###.###.#.#.#.#.###.#.#.#####.#.#.###.#.#########.###.#########.#.#.###.#.#.###.#.###.#####.#.#.#.###.#######.#.#.# +#.#.....#.....#.#.#.....#...#.#.#...#...#...#.#.#.....#.#.#.#.....#.........#.#...#.....#.#.#.......#...#.#.#...#.....#.#.....#...#.....#.#.# +###.###.###.#.###.#.#.#.###.#.#.#########.###.#.#.#.###.#.#.#.#.#####.#######.###.###.#.#.#.###.#.###.###.#.#.###.#####.#.###.#####.#.###.#.# +#...#.......#.....#.#...#.#...#...................#.#.....#.#.#.......#.........#.....#.#.#...#.....#.#...#.#...#...#...#...#.....#.#...#...# +#.#########.#######.#.#.#.#########.#.#####.###.#####.#####.#.#.#######.#.#############.#.###.###.###.#.###.###.#.###.###.#.#####.#.###.###.# +#.........#.#...#...#.#.......#.....#.#...#...#.#...#.#.....#.#.......#.#.......#.....#.#...#...#.#...#.#.....#.#.#...#.....#...#...#.#...#.# +#.#######.#.#.#.#.###.#######.#.###.#.#.#####.###.#.#.#.#####.#.#####.#####.###.#.###.#.#.#.###.###.###.#.###.#.#.#.###.#.###.#######.#.###.# +#.#.....#.#...#.#...#.......#...#...#...#.....#...#...........................#...#...#...#...#.....#.#.#.#.....#.#.........................# +#.#.###.#.#########.#.#####.#.#######.###.#####.#######.#.#.#.#.#####.#.#.#######.#.#####.#####.#####.#.#.#####.#.###.###.#####.#.###.####### +#.#.#...#.........#...................#...#.....#.....#...#.#.#.....#.#.#...#...#.#.......#...#.#.............................#.#.....#.....# +#.#.#.#.#######.#.#.#.#.#######.#######.###.#####.#.#######.#.#.###.#.#.###.#.#.#####.###.#.#.#.#.#####.#.#.#####.#.###.#.#.#.#.#.###.#.###.# +#.......#.#.....#.#...#.....#...#.....#.#...#.....#.#.......#.................#.#...#...#...#.#...#.....#.#.#.....#.#.#.....#.#.#...#.#.#...# +#.###.#.#.#.#########.#####.#.###.###.#.#.###.#####.#.#########.#.#####.#.###.#.#.#.#####.###.#####.#####.#.#######.#.###.###.#.#.#.#.#.#.### +#S....#...#...............#.......#...#.......#.....#...........#.......#.....#...#.......#.........#...............#...........#.#.....#...# +############################################################################################################################################# diff --git a/day16/main.go b/day16/main.go new file mode 100644 index 0000000..739267a --- /dev/null +++ b/day16/main.go @@ -0,0 +1,129 @@ +package main + +import ( + "math" + + "git.mstar.dev/mstar/goutils/sliceutils" + + "git.mstar.dev/mstar/aoc24/util" +) + +// A crossing is a path location with 3 or 4 other paths next to it +type Crossing struct { + At util.Vec2 + LowestScore int + LowestFrom int // Index into list of crossings +} + +var ( + DirUp = util.Vec2{X: 0, Y: -1} + DirRight = util.Vec2{X: 1, Y: 0} + DirDown = util.Vec2{X: 0, Y: 1} + DirLeft = util.Vec2{X: -1, Y: 0} +) + +var startDir = DirRight + +// Get the size of the bord +func getSize(lines []string) util.Vec2 { + return util.Vec2{X: int64(len(lines[0])), Y: int64(len(lines))} +} + +// Count the paths next to a given positon +func countPathsAt(lines [][]rune, at util.Vec2) int { + center := lines[at.Y][at.X] + if center == '#' { + return 0 + } + if center == 'E' { + return 1 + } + if center == 'S' { + return 1 + } + acc := 0 + if util.SafeGet(lines, at.Up()) != '#' { + acc++ + } + if util.SafeGet(lines, at.Down()) != '#' { + acc++ + } + if util.SafeGet(lines, at.Left()) != '#' { + acc++ + } + if util.SafeGet(lines, at.Right()) != '#' { + acc++ + } + return acc +} + +func findAllCrossings(lines [][]rune) []Crossing { + out := []Crossing{} + + for iy, line := range lines { + for ix := range line { + vec := util.Vec2{X: int64(ix), Y: int64(iy)} + pathCount := countPathsAt(lines, vec) + if pathCount >= 3 { + out = append(out, Crossing{At: vec, LowestScore: math.MaxInt, LowestFrom: -1}) + } + } + } + + return out +} + +// Convert a list of crossings into x y map of pointers to those crossings +func crossingListToPointerMap(crossings []Crossing) map[int64]map[int64]*Crossing { + return nil +} + +func findStart(lines [][]rune) util.Vec2 { + for iy, line := range lines { + for ix, char := range line { + if char == 'S' { + return util.Vec2{X: int64(ix), Y: int64(iy)} + } + } + } + // Return invalid positon if none found + return util.Vec2{X: -1, Y: -1} +} + +func findEnd(lines [][]rune) util.Vec2 { + for iy, line := range lines { + for ix, char := range line { + if char == 'E' { + return util.Vec2{X: int64(ix), Y: int64(iy)} + } + } + } + // Return invalid positon if none found + return util.Vec2{X: -1, Y: -1} +} + +func walk(area [][]rune, from util.Vec2, dir util.Vec2) { + // Idea: walk forward from start until crossing or wall + // At crossing, defer a walker for both sides (if not walled off) but prioritise forwards + // Keep track of current score, one crossing = 1 point + // walking length doesn't matter because negligable compared to turn cost + // At crossing, check if own score is lower than current score + // If it is, update score and set own origin + + // Special case: + // If at end, update end "crossing" following the earlier rules +} + +func main() { + inputLines := util.FileContentToNonEmptyLines(util.LoadFileFromArgs()) + // size := getSize(inputLines) + area := sliceutils.Map(inputLines, func(t string) []rune { return []rune(t) }) + crossings := findAllCrossings(area) + + start := findStart(area) + // Start always has the lowest score + crossings = append(crossings, Crossing{At: start, LowestScore: math.MinInt, LowestFrom: -1}) + end := findEnd(area) + // While end is just another "crossing" + crossings = append(crossings, Crossing{At: end, LowestScore: math.MaxInt, LowestFrom: -1}) +} diff --git a/day16/sample b/day16/sample new file mode 100644 index 0000000..2c21676 --- /dev/null +++ b/day16/sample @@ -0,0 +1,15 @@ +############### +#.......#....E# +#.#.###.#.###.# +#.....#.#...#.# +#.###.#####.#.# +#.#.#.......#.# +#.#.#####.###.# +#...........#.# +###.#.#####.#.# +#...#.....#.#.# +#.#.#.###.#.#.# +#.....#...#.#.# +#.###.#.#.#.#.# +#S..#.....#...# +############### diff --git a/day16/sample2 b/day16/sample2 new file mode 100644 index 0000000..bc61c57 --- /dev/null +++ b/day16/sample2 @@ -0,0 +1,17 @@ +################# +#...#...#...#..E# +#.#.#.#.#.#.#.#.# +#.#.#.#...#...#.# +#.#.#.#.###.#.#.# +#...#.#.#.....#.# +#.#.#.#.#.#####.# +#.#...#.#.#.....# +#.#.#####.#.###.# +#.#.#.......#...# +#.#.###.#####.### +#.#.#...#.....#.# +#.#.#.#####.###.# +#.#.#.........#.# +#.#.#.#########.# +#S#.............# +################# diff --git a/util/slices.go b/util/slices.go index 7f74a3e..66ede8c 100644 --- a/util/slices.go +++ b/util/slices.go @@ -10,3 +10,12 @@ func SliceSwap[T any](s []T, x, y int) { s[x] = s[y] s[y] = tmp } + +func SafeGet[T any](s [][]T, at Vec2) T { + var none T + if at.X < 0 || at.Y < 0 || at.Y >= int64(len(s)) || at.X >= int64(len(s[0])) { + return none + } + + return s[at.Y][at.X] +} diff --git a/util/vec.go b/util/vec.go index c723afb..9890aab 100644 --- a/util/vec.go +++ b/util/vec.go @@ -15,3 +15,19 @@ func (v Vec2) Add(a Vec2) Vec2 { func (v Vec2) Eq(a Vec2) bool { return v.X == a.X && v.Y == a.Y } + +func (v Vec2) Up() Vec2 { + return v.Add(Vec2{0, -1}) +} + +func (v Vec2) Down() Vec2 { + return v.Add(Vec2{0, 1}) +} + +func (v Vec2) Left() Vec2 { + return v.Add(Vec2{-1, 0}) +} + +func (v Vec2) Right() Vec2 { + return v.Add(Vec2{1, 0}) +}