Compare commits

..

2 commits

Author SHA1 Message Date
0dda547a5a day 25a 2023-12-25 13:51:14 +01:00
18797afee1 day 23a 2023-12-25 11:23:00 +01:00
7 changed files with 1541 additions and 0 deletions

23
23/day23/example.txt Normal file
View file

@ -0,0 +1,23 @@
#.#####################
#.......#########...###
#######.#########.#.###
###.....#.>.>.###.#.###
###v#####.#v#.###.#.###
###.>...#.#.#.....#...#
###v###.#.#.#########.#
###...#.#.#.......#...#
#####.#.#.#######.#.###
#.....#.#.#.......#...#
#.#####.#.#.#########v#
#.#...#...#...###...>.#
#.#.#v#######v###.###v#
#...#.>.#...>.>.#.###.#
#####v#.#.###v#.#.###.#
#.....#...#...#.#.#...#
#.#########.###.#.#.###
#...###...#...#...#.###
###.###.#.###v#####v###
#...#...#.#.>.>.#.>.###
#.###.###.#.###.#.#v###
#.....###...###...#...#
#####################.#

141
23/day23/input.txt Normal file
View file

@ -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#.###.#.#####.#.#####.#.###.#.#.#
#...#...#...#.#.#.#.#.#.#...#...#.#.#.....#.#...#...#.#.#.#.#.#.#.#.#.#.#...#.#.#.#.....#...#.#.#.#...#...>.>.#...#...#...#...###...###.#.#.#
###.#.#######.#.#.#.#.#.#########.#.#.#####.###.###.#.#.#.#.#.#.#.#.#.#.#.###.#.#.#.#####.#.#.#.#.###.#.#######.#####.#.#####.#########.#.#.#
#...#.......#.#.#.#.#.#...#.......#.#.#...#.###.#...#.#.#.#.#.#.#.#.#.#.#...#.#.#.#...#...#.#.#.#.#...#.......#...#...#...#...#.........#.#.#
#.#########.#.#.#.#.#.###.#.#######.#.#.#.#.###.#.###.#.#.#.#.#.#.#.#.#.###.#.#.#.###.#.###.#.#.#.#.#########.###.#.#####.#.###.#########.#.#
#...........#...#...#.....#.........#...#...###...###...#...#...#...#...###...#...###...###...#...#...........###...#####...###...........#.#
###########################################################################################################################################.#

130
23/day23/main.py Executable file
View file

@ -0,0 +1,130 @@
#!/usr/bin/env python3
import random
from collections import defaultdict
import sys
sys.setrecursionlimit(15000)
no_slippery = True
PATH = 1
FOREST = 2
SLOPE_NORTH = 3
SLOPE_EAST = 4
SLOPE_SOUTH = 5
SLOPE_WEST = 6
map = []
with open("input.txt", "r") as f:
for line in f:
row = []
for char in line.strip():
tile = None
if char == ".":
tile = PATH
if char == "#":
tile = FOREST
if char == "^":
tile = SLOPE_NORTH
if char == ">":
tile = SLOPE_EAST
if char == "v":
tile = SLOPE_SOUTH
if char == "<":
tile = SLOPE_WEST
row.append(tile)
map.append(row)
def find_path(row):
for i, tile in enumerate(row):
if tile == PATH:
return i
start = (0, find_path(map[0]))
goal = (len(map) - 1, find_path(map[-1]))
def valid_next_step(destination, illegal_slope):
global no_slippery
(y, x) = destination
try:
tile = map[y][x]
if no_slippery:
return tile not in [FOREST]
else:
return tile not in [illegal_slope, FOREST]
except:
return False
def possible_directions(coords):
(y, x) = coords
tile = map[y][x]
if tile == FOREST:
raise Exception("Cannot be in a forest!")
if not no_slippery:
if tile == SLOPE_NORTH:
return [(y - 1, x)]
if tile == SLOPE_EAST:
return [(y, x + 1)]
if tile == SLOPE_SOUTH:
return [(y + 1, x)]
if tile == SLOPE_WEST:
return [(y, x - 1)]
steps = [
((y - 1, x), SLOPE_SOUTH),
((y, x + 1), SLOPE_WEST),
((y + 1, x), SLOPE_NORTH),
((y, x - 1), SLOPE_EAST),
]
valid_destinations = []
for destination, illegal_slope in steps:
if valid_next_step(destination, illegal_slope):
valid_destinations.append(destination)
return valid_destinations
longest_path = -1
memo = defaultdict(lambda: -1)
def walk(path, length, position):
global longest_path
if length < memo[position]:
return
if position == goal:
if length > longest_path:
longest_path = length
print("NEW BEST", longest_path)
return
cool = possible_directions(position)
random.shuffle(cool)
for next_position in cool:
if next_position not in path:
next_path = dict(path)
next_path[position] = True
walk(next_path, length + 1, next_position)
walk({}, 0, start)
print(longest_path)

13
23/day25/example.txt Normal file
View file

@ -0,0 +1,13 @@
jqt: rhn xhk nvd
rsh: frs pzl lsr
xhk: hfx
cmg: qnr nvd lhk bvb
rhn: xhk bvb hfx
bvb: xhk hfx
pzl: lsr hfx nvd
qnr: nvd
ntq: jqt hfx bvb xhk
nvd: lhk
lsr: lhk
rzs: qnr cmg lsr rsh
frs: qnr lhk lsr

1212
23/day25/input.txt Normal file

File diff suppressed because it is too large Load diff

21
23/day25/main.py Executable file
View file

@ -0,0 +1,21 @@
#!/usr/bin/env python3
import networkx as nx
G = nx.Graph()
with open("input.txt", "r") as f:
for line in f:
pieces = line.strip().split(": ")
start = pieces[0]
for end in pieces[1].split(" "):
G.add_edge(start, end)
cut_edges = nx.minimum_edge_cut(G)
G.remove_edges_from(cut_edges)
part1 = 1
for subgraph in (G.subgraph(c) for c in nx.connected_components(G)):
part1 *= subgraph.number_of_nodes()
print(part1)

View file

@ -0,0 +1 @@
networkx==3.2.1