Day 16 part 1
This commit is contained in:
parent
588465d7e5
commit
507e3a3e39
2 changed files with 212 additions and 0 deletions
141
input/day16
Normal file
141
input/day16
Normal file
|
|
@ -0,0 +1,141 @@
|
|||
#############################################################################################################################################
|
||||
#.............#.......#...#...............#...........#.......................#...........#.............#.#.............#...#.....#........E#
|
||||
#.#.#########.#.#####.#.###.#####.#######.#.#.###.###.#.#####.#.#.###.#.#####.#######.#.###.#.#.###.###.#.#.#.#####.###.#.###.###.#.#######.#
|
||||
#.#.........#...#...#.#...#.....................#.#.........#.#...#...#...#.#...#...#.#.....................#.......#.#.#...#.#.#...#...#.#.#
|
||||
###########.#####.###.###.#####.#.#.#######.#.###.#######.#.#.#########.#.#.###.#.#.#.#.#.###.#.###.###.#####.#####.#.#.###.#.#.#####.#.#.#.#
|
||||
#...........#...#...#.#.....#...#.......#...............................#.....#...#.#.#...#.#.#.#.#...#.#...#.#.......#.#...#.........#...#.#
|
||||
#.#########.#.#.#.#.#.#.#####.#######.#.#.#.###.#.#.#.#####.#########.#.###.#######.#.#####.#.#.#.#.#.#.#.#.#.#.#####.#.#.#####.###########.#
|
||||
#.#.......#.#.........#.#.....#.....#...#.......#.#.#.....#.#...#.....#.#...#...#...#.#...#.#.#...#...#...#...#.....#...#.......#...........#
|
||||
#.#.#####.###.#.#####.#.#.#########.#.###########.#.#####.#.###.#.#####.#.###.#.#.###.#.#.#.#.#.#.#.#########.#####.###########.#.#####.###.#
|
||||
#...#...#...#.#.....#.#...........#.#.....#.#...#.#.#...#...#...#...#.....................#.#...#.#...........#...#.#.........#.#...#.....#.#
|
||||
#.###.#.#.#.#.#####.#.###########.#.#.###.#.#.#.#.#.###.#####.#.###.###.#.#.#######.###.#.#.###.###.#####.#####.#.#.###.#.###.#.###.#.#.#.#.#
|
||||
#...#.#.#.#.....#.....................#...#.#.#...#.....#.....#.#.#...#.......................#.#...#...#.#.....#.........#...#.#...#.#.#.#.#
|
||||
#.###.#.#########.###.#.#######.#.###.#.###.#.#########.#.###.#.#.###.#.###.#.#####.#.#####.###.#.#.#.#.#.#.#####.###.#.#.###.###.###.#.###.#
|
||||
#.#...#.......................#.#.#.....#...#...#.....#.#...#.#...#...#...#.#.....#.#...#...#...#.#.#.#.#.......#...#.#.#...#.#...#.#.#.#...#
|
||||
#.#.###########.#.#.#.###.#.#.#.###.#.###.#.###.#.#.###.#####.###.#.#####.#.###.#.#.#.#.#####.###.#.#.#.#.#######.###.#.###.#.#.###.#.#.#.###
|
||||
#.#.#.........#...#.#.....#.#.#.......#...#...#...#.#...#.....#...#.......#...#.#.#.#.#.#.....#...#...#.#.#.....#.....#.#...#...#...#.#...#.#
|
||||
#.#.###.#.###.#####.#######.#.#.#####.#.#.###.###.###.###.#####.#############.#.#.#.###.#.#.###.###.###.###.###.#.#######.#.#####.#.#.#####.#
|
||||
#.#.#.....#.............#...........#...#.#...#...#...#...#...#.#.....#.......#.#.#.....#.#.#...#.....#.....#...#.........#.#...#.#...#.....#
|
||||
###.#.#.###.#.###.#####.###.###.#####.###.###.#.###.###.###.###.###.###.###.#####.#.#####.#.#.#####.#########.###########.###.#.###.#####.#.#
|
||||
#...#...#...#...#.....#...#...#.#.....#.....#.#.#.......#...........#...#...#...#...#...#.#.#.....#.#.......#...#.....#...#...#...#...#...#.#
|
||||
#.###.#.#.###.#.#####.###.###.#.#.#####.###.###.#.#####.#.#####.#####.#######.#.#####.#.#.#.#####.#.#.#.###.###.#.###.#####.#####.###.#.###.#
|
||||
#...#.#.......#...#...#...#...#.#.#.....#.#.....#.#.....#.#...#.#.....#.......#.......#.#.....#...#...#...#...#.#...#.......#...#...#...#...#
|
||||
#.#.###.#####.###.#.###.###.###.#.###.#.#.#######.#.#.#####.#.###.#####.###############.#.###.#.#######.#.#####.#.#.#########.#####.###.#.#.#
|
||||
#...#.....#...#...#.#...#...#...#.....#...#...#...#.#.#.....#...#.....#.#...#.........#.#...#...#.....#.#.....#.....#.......#.....#...#...#.#
|
||||
#.###.#.#.###.#.#.#.#.###.###.#.#########.#.#.#.###.#.#.#######.###.#.#.#.###.#######.#.#.#.#######.#.#.#####.#####.#.###.###.###.###.#.#.###
|
||||
#...#...#...#.#.#.#.#.........#.........#.#.#.#.#...#.#.#.............#.#.#.......#...#...#.........#.#...#...#.....#.#...#...#.....#...#...#
|
||||
#.#.###.###.#.#.#.#.###########.#######.#.#.#.#.#.###.#.###########.#.#.#.#.#####.#.#.#.#.###########.###.#.#.#.###.#.#####.###.#.#####.#.#.#
|
||||
#.#.....#...#...#.#.......#.....#...#...#.#.#.#...#...#.........#.....#.#...#...#.#.#...#.#.......#...#.....#...#...#.........#.#.#...#.....#
|
||||
#.#######.###.###.#######.###.#.#.#.#####.#.#.#.###.###########.#######.#####.#.#.#.###.#.#.#######.###.#########.#######.#####.###.#.#.#.#.#
|
||||
#...#.....#.......#.....#...#...#.#.#.......#.....#...........#.#.......#.....#.#.#...#.#.#.......#.....#.......#...#...#...#...#...#.#...#.#
|
||||
#.#.#.#######.#####.###.#.#.#####.#.#.#############.#########.#.#.#######.#####.#####.#.#.#.#####.###########.#.###.#.#.###.#.###.###.#.#.#.#
|
||||
#...#...........#.....#.#.#...#...#...#.......#...#...#.......#...#...#.....#.#.#.....#.#.#.#.....#...........#.....#.#...#.#.#...#.....#.#.#
|
||||
#.#.###########.#.#####.#.###.#.#######.#####.#.#.###.#.#####.#####.#.#.###.#.#.#.#.#####.#.#.###.#.#.###.#########.#.###.###.#.#########.#.#
|
||||
#...#.......#...#...#...#.#...#.......#...#.#...#.....#.#...#...#...#.....#.#...#.#.#.....#.#.#...#.#...#.#.......#...#...#...#.....#.....#.#
|
||||
#.###.#####.#.#.#.###.###.#.###.#########.#.#.#.#######.#.#.###.#.###.#####.#.###.#.#.#####.#.#####.#.#.###.#####.#####.###.#######.#.#.#.#.#
|
||||
#.#.#.#.......#.#.#...#.....#...#.......#...#.#.#.......#.#.#...#.....#.....#.#...#.#...#.#.#.....#.#.#.......#...#...#.#.......#...#...#.#.#
|
||||
#.#.#.###########.#.#####.#.#.#.#.#####.###.#.#.#.###.###.#.#.#########.#####.#.###.###.#.#.#####.#.#.###.#####.#.###.#.#######.#.###.###.#.#
|
||||
#...#.......#.....#...#...#.#.#.#...#.#...#.#...#...#.#.#.#.#.........#...#...#...#...#.#.......#.#...#.....#...#.....#...#...#.#.#...#...#.#
|
||||
###.#######.#.#######.#.###.#.#.###.#.###.#.#########.#.#.#.#########.###.###.###.###.#.#########.###.#.###.#.###.#######.#.#.#.#.###.#####.#
|
||||
#...#...#...#...#.....#...#.#.#...#...#.#...#.........#.#.#.........#...#...#...#.#...#.........#.....#.#.#...#...#.....#.#.#...#...#.......#
|
||||
#.#####.#.#####.#.#######.#.#.#.#.###.#.#######.#######.#.###.#.#######.#.#.#.#.#.#############.#######.#.###.#.###.#.#.#.#.###.###.#######.#
|
||||
#.....#.#.#.....#.#.......#.#...#...#.#...#.....#.#.......#...#.#.......#.#.#...#...#...........#.....#.#.......#...#.#.#...#.#...#.......#.#
|
||||
#####.#.#.#.#####.#####.#########.###.#.#.#.#.###.#.#######.#####.#######.#.#.#####.#.#########.#.###.#.#.#######.###.#######.###.###.###.#.#
|
||||
#.....#.#...#...#.....#...........#...#.#...#.....#.#.....#...#...#.......#.#.......#.#...#...#...#.....#...#...#...#...........#.....#...#.#
|
||||
#.#####.#####.#######.###########.#.#######.###.#.#.#.###.#.#.#.###########.#########.#.#.#.###.#.###########.#.###.#.###.#########.#.#.###.#
|
||||
#.....#...#.#.......#.......#...#.#.......#...#.#.....#.#.#.#.#.....#...............#.#.#...#...#.....#...#...#...#.....#...........#...#.#.#
|
||||
#####.#.#.#.#.#####.#######.#.#.#########.#.#.#.#####.#.#.#.#.#####.#.###.#.#######.#.#.#####.#######.#.#.#.#.###.#####.#############.###.#.#
|
||||
#.....#.#...#.#...#.......#...#.........#.#.#.....#.......#.#.....#.#.#...#.#.....#.#.#...#...#...#...#.#...#...#.......#...........#.#.....#
|
||||
#.#####.#.###.#.#########.###########.###.#.#.###.#####.#.#.#.#.###.#.#.###.###.#.#.#.#.#.#.###.#.#.###.#######.###############.###.#.#####.#
|
||||
#.........#...#.........#...........#...#.#.....#.....#.....#.#.#...#.#...#.....#.#.#.#.#.......#.#...#.......#.................#...#.....#.#
|
||||
#.###.#.#.#.#.#.#######.#####.###.#.###.#.###.#######.#######.###.###.###.#########.#.###############.#######.#.#######.#############.###.#.#
|
||||
#...#...#...............#...#...#...#...#...#.#.....#...#...#.........#.......#.....#.#.............#.....#...#.......#.#...#...#.........#.#
|
||||
###.#.###.###.###.#######.#.###.###.#.#####.###.###.#.#.#.#.###.#############.#.#.###.#.###########.#.###.#.#########.###.#.#.#.#.###.#####.#
|
||||
#.#.#...#.#.......#...#...#...#...#.#.....#.....#.#.#.#...#...#.#.......#...#.#.#.#...#.#.......#...#.#.....#...#.....#...#.#.#...#.....#...#
|
||||
#.#.#.#.#.#.#.#####.#.#.#####.###.#.#####.#######.#.#.#######.#.#.#####.#.###.#.###.###.#######.#.#####.###.#.#.#.#####.###.#.#####.#.###.###
|
||||
#...#.#...#.#.......#...#...#.....#.#...#.......#...#...#...#.#.#.....#.#.....#...#.#.........#.........#...#.#.#...#...#.#...#...#.......#.#
|
||||
#.###.#.#.#.#.###.#######.#.#######.#.#.#######.#.#####.###.#.#######.#.#.###.###.#.###.#####.#######.###.###.#.###.#.###.#####.#.#.#.#####.#
|
||||
#.#.......#...#.........#.#.......#.#.#.....#.....#.#...#.......#...#.#.#...#.#...#...#.#...#.......#.#...#...#...#.#.#.........#.#...#...#.#
|
||||
#.#####.#.###.#.#######.#.###.#.###.#.#.###.#.#####.#.###.#.###.#.#.#.#.#.#.#.#.#####.#.###.#######.###.#####.###.#.#.#.#####.###.###.#.#.#.#
|
||||
#.....#...#...#.......#.#...#.#.#...#.#.#...#...#.#...#...#.#...#.#...#...#.#.#.....#.#...#.......#.....#.....#...#.#.......#...#...#...#...#
|
||||
#####.#.###.#####.###.#.#.###.#.#.#####.#.###.#.#.#.#####.#.#.#.#.#########.#.#####.#.###.#####.#.###.#.#.#####.###.#######.#######.#.#####.#
|
||||
#...#.#...#.....#...#.#.#.....#.#.#.....#.....#.#...#.....#.#...#...#.#...#.#...........#.....#.#...#...#.#.........#.......#...........#...#
|
||||
#.###.#.#######.#####.###.#.#####.#.###########.###.#.#.#####.#####.#.#.#.#.#.#########.#####.#.#.#.#####.#.#########.#######.###########.###
|
||||
#.#...#.........#...#.#...#...#...#.#.....#...#...#.#.#.#.....#...#...#.#.#.#.#...#.....#...#...#.....#...#.#...#.....#.#.................#.#
|
||||
#.#.###.#########.#.#.#.#####.#.###.#.###.#.#####.#.###.#.###.#.#.#.###.#.#.###.#.#.#######.###.#####.#.###.#.#.#.#####.#.#.###.###########.#
|
||||
#.#.....#.........#...#.#.....#...#.#...#.#.......#.....#...#.#.#...#...#...#...#...#.......#.......#...#.#...#.#.#.....#.#...#.....#.......#
|
||||
#.#####.#.###.###.#####.#.###.###.#.###.#.#####.###########.###.#####.###.#.#.#######.#.#####.###.#.#####.#.#.###.#.#.###.###.#####.#.#######
|
||||
#...#.....#...#...#...#.#...#...#.#.#.........#.............#...#...#...#.#.#.........#.....#.#.#.#...#.....#.....#.#.....#...#.#...#.......#
|
||||
#.#.#.#.###.#.#.###.#.#.###.#####.#.#.#.#####.#.###.#######.#.###.#.###.#.#.#.#.###########.#.#.#.###.#.#.###.#####.#######.#.#.#.#########.#
|
||||
#.#...#.....#...#.#.#...#.#.......#.#...#...#...#.....#.....#.#...#.#...#...#.#...........#.....#.#...#...#...#.....#.....#.#.#.#...........#
|
||||
#.#####.#####.###.#.###.#.#########.###.###.###.#.###.###.#.#.###.###.#######.#################.#.###.###.#.###.#####.###.#.#.#.###########.#
|
||||
#.....#...#.#.....#.....#.....#...#...#.#.....#...#.#.#.....#.#...#.........#.........#...#...#.#.......#.#...#.#.#...#.#.#.#.#...........#.#
|
||||
#####.###.#.#.###.#####.###.#.#.#.#.#.#.#.#.#.#####.#.#.#.#.#.#.#.#.#######.#.###.#.#.#.#.#.#.#.#####.#.#.###.#.#.#.###.#.#.#.###.#########.#
|
||||
#.....#...#.....#.....#.....#.#.#...#.#...#.#.....#.#...#.....#.#.#.....#...#...#...#...#...#.#...#...#.....#.#...#.#.#...#...#...#.........#
|
||||
#.###.#.###.#.#.#.###########.###.###.#####.#####.#.#####.#.#.#.#.#####.#.###########.###.###.#####.###.#####.#.###.#.#.###.#.#.#.#.#########
|
||||
#.#.....#.....#...#.......#.#...#...#.......#...#.......#.#.#...#.#...#.#.#.................#.....#.#.....#...#.#...#...#...#...#.#...#.....#
|
||||
#.#.#.###.#.#.###.#.###.#.#.###.###.###.###.#.#.#####.###.#.###.###.#.#.#.#.#######.#######.#####.#.#.#####.###.#.###.#####.#####.###.#####.#
|
||||
#.#.#.#.....#...#.#.#.#.#.#...#...#...........#...#...#...#...#.#...#...#.#...#.....#.....#.......#...#.#...#...#.#.#.#.....#...#.....#...#.#
|
||||
#.#.###.###.#.#.###.#.#.#.###.###.###.###.#######.#.###.#######.#.###.###.###.#######.###.#########.###.#.###.###.#.#.#.#####.#.#.###.#.#.#.#
|
||||
#.#.......#.....#.....#.#.#...#...#...#...#...#...#.#.#.........#...#.#...#...#.......#.#.#.......#.....#.#...#...#.....#...#.#.#.....#.#...#
|
||||
#.#######.#.#.###.#####.#.#.#.#.###.#######.#.#.###.#.#############.###.###.###.#######.#.#.#.###.#######.#.###.#########.#.#.#.#.###.#.###.#
|
||||
#.#.#...#.#.........#...#.#.#.#.#...........#.#...#.#.............#...#...#.............#.#.#...#.........#...#...#.....#.#...#.#...#.#.#...#
|
||||
#.#.#.#.###.#.#######.###.#.#.#.#######.#.###.#####.###.#######.#####.###.#####.#########.#.###.###########.#####.#.###.#.#####.#.#.#.#.#####
|
||||
#...#.#...#.....#.....#.#...#.#.......#.#...#...........#.......#.......#.....#.#...#.....#.#.#.#.#...#...#.#.....#.#.....#.....#.#.#.#.....#
|
||||
#####.###.#.#.###.#####.#####.#######.#.###.#######.#############.#####.#####.###.#.#.#####.#.#.#.#.#.#.#.#.#.#####.#.#####.#####.#.#.#.###.#
|
||||
#.....#.#.#.......#.........#...#...#.........#...#.........#...#.....#.....#...#.#...#.....#.#...#.#...#...#.....#...#...#.................#
|
||||
#.#####.#.#.#.#.#########.#####.#.#.#.#####.#.###.#.#######.#.#.#.###.###.#.###.#.#########.#.#.#.#.#############.###.###.#####.#.#####.#.###
|
||||
#...#.#...#...#.#.......#.........#.#.....#.......#.......#...#.#...#.#...#...#.#.#.......#...#.#.#.#...............#.#.....#.#.#.#...#.#...#
|
||||
###.#.#.###.#.#.#.#####.###########.#####.#######.#######.#.###.###.#.#.###.#.#.#.#.###.#.#####.#.#.#.#.#############.#.###.#.#.#.#.#.#####.#
|
||||
#...#...........#.#...#...#...#.........#...#...#...#...#.#...#...#.#.#.....#.#...#.#...#.#.....#...#...........#...#...#.....#.#...#.....#.#
|
||||
#.#####.###.#.#.#.###.###.#.#.#############.#.#.#.###.#.#.###.###.###.###.###.#######.###.#.#####.#############.#.#.#####.#.#.#.#.#######.#.#
|
||||
#.#...#...#.#.#.#...#...#...#.#.....#.....#.#.#.#.#...#...#.....#.....#.....#.#.......#.#...#.....#.....#...#.#...#.......#.#.#.........#...#
|
||||
#.#.#.###.#.#.#.###.#.###.###.#.###.#.###.#.###.#.#.#######.###########.###.#.#####.###.#####.#####.###.#.#.#.#########.###.#.###.###.#####.#
|
||||
#...#.#.#.....#.#...#.....#...#...#.#.#.#.....#...#.....#...............#.#.#.......#.......#.......#.#...#.#.........#.....#.#...#.#.#.....#
|
||||
#.###.#.###.###.#.#####.#.#.#.#.#.#.#.#.#.###.#####.###.#.#############.#.#.#########.#.###.#########.#####.#.#####.#########.#.###.#.#.#####
|
||||
#...#.#...#.....#...#...#...#.#...#.#.#.#...#.#...#.#...#.#.........#...#.........#...#.#...#...#.....#.....#...#.#...#.......#...#...#.#...#
|
||||
###.#.###.#.#######.#.###.#.#.###.#.#.#.###.#.#.#.###.###.#.#.###.###.#######.###.#####.#.###.###.###.#.#.#####.#.###.#.###.#####.###.#.#.###
|
||||
#.#.#...#.........#.#.#.....#.....#.......#.#...#.....#.....#.#.#.#.........#...#...#...#.#.....#...#...#.....#.......#.#.#.....#.#.....#...#
|
||||
#.#.###.#########.#.#.#.#######.#.#########.###############.#.#.#.#.###.###.#.#####.#.###.#####.###.#####.###.###.###.#.#.#.#.#.#.#.#.#####.#
|
||||
#.#.#.#.#...#...#.#.......#...#.#.....#.....#.............#.#...#.#.......#.#.......#.#.......#...#.#.#.....#.#...#.........#.......#.....#.#
|
||||
#.#.#.#.#.#.#.#.#.#.#####.#.#.#.#.#####.###.#.#.#########.#.#####.#########.#.#######.#######.#.###.#.#.#.#.#.#####.#.#####.#.#######.###.#.#
|
||||
#.#.#.#...#.#.#.#.#.....#...#.#...#.....#...#.#...#.................#...#.......#.....#...#.....#...#.....#.#...#...#...#...#.#.......#.....#
|
||||
#.#.#.#####.###.#.#.###.#####.#####.#####.#.#####.#.###############.#.#.#.#####.#.#.###.#.#####.#.#######.#.###.#.#######.###.#.#####.#####.#
|
||||
#.........#.#...#.#.#.......#...#.#...#...........#...#...#.........#.#...#...#.#.#.....#.....#.#.....#...#.#...#.....#.....#.#.#...#...#.#.#
|
||||
#.#########.#.###.#.#.#####.###.#.###.#####.#####.#.#.#.#.#######.###.#####.###.###########.#.#.#####.#####.#.#####.#.#.#####.#.#.#.#.#.#.#.#
|
||||
#...........#.....#.#.#...#...#.#.........#.....#.......#.#.....#.#.#.#...#...............#.#.#.#...#.....#.#.....#.#.....#...............#.#
|
||||
#####.#.#.###.#######.#.#.#.###.###.#####.###.#.###.#####.#.###.#.#.#.#.#.#.#############.###.#.###.#####.#.#.###.#########.###.#.###.#.#.#.#
|
||||
#...#.#.#.#...........#.#...#...#...#...#.....#.......#.....#.#.#...#.#.#...#.....#...#...#...#.........#...#.....#...#...#.....#...#...#...#
|
||||
#.#.#.#.#.#############.#####.###.#.###.###.#####.###.#######.#.#####.#####.#.###.###.#.###.#################.#####.#.#.#.#######.#.#.#####.#
|
||||
#.#...#...#.....#...#...#.....#...#.....#...#.......#...#.....#...#...#...#.#.#.#...#...#...#...............#.......#...#.......#.#.......#.#
|
||||
#.#######.#.###.#.###.###.#######.#####.#.#.#.#.#######.#.#.#####.#.###.#.#.#.#.###.#.###.###.###########.#####################.###.#####.###
|
||||
#.....#...#...#.#.....#...#.......#...#...#.#.#.#.......#.#.........#...#.#.#...#...#.....#...#.....#...#.#...............#...#...#.#...#...#
|
||||
#.###.###.###.#.#######.###.#######.#.#####.###.#.#.#####.###########.###.###.#.#.#.#####.#.###.###.#.#.#.#.#######.#####.#.#.###.#.###.###.#
|
||||
#...#.....#...#.........#...........#.....#.....#.#.#...#...#...#...#...#...#...#.#.#...#.#.#...#.#...#.#...#.....#...#.....#...#.#.....#...#
|
||||
###.#####.#.#############.#.#.#####.#.#########.#.###.#.###.#.#.#.#.###.###.#.###.#.#.#.###.#.###.#####.#####.#.#.###.#######.###.#####.#.###
|
||||
#...#...#.#.#.....#.....#...#.....#.#.#...#.....#.#...#.#.#.#.#.#.#...#...#.#.#...#.#.......#...#...#.....#...#.#...#.....#...#...#.....#...#
|
||||
#.#####.#.#.#.###.#.#.#.#.#####.###.#.#.#.#.###.#.#.###.#.#.#.#.#.#.#.#.#.#.#.#.#####.#########.#.###.#####.###.###.#####.#.###.#######.###.#
|
||||
#.#...#.#.#.#.#.#...#.#.#...........#.#.#...#.#...#.#.#.#.....#.#...#...#.#.#.#.....#.#.....#.....#...#.......#...#.#...#.#...#.#.....#.#...#
|
||||
#.#.#.#.#.#.#.#.#####.#.#.#.#.#########.#####.#.###.#.#.###########.###.#.#.#.###.#.#.#.###.#######.#.#.#########.#.###.#.#####.###.#.###.#.#
|
||||
#...#...#...#.......#.#.#.#.#.#...#.....#.....#.#...#.#.......#.....#...#.#...#...#...#.#.#.#.....#.#...#.....#...#.#...#.#...............#.#
|
||||
#######.#.#########.#.#.#.###.#.#.#.#####.###.#.#.###.#######.#.#####.###.#####.#.#####.#.#.#.###.#.#.###.###.#.###.#.#.#.#.#.###.#####.#.#.#
|
||||
#.#.....#...#.....#.#.#...#...#.#...#.....#...#...#.........#...#...#.....#.....#.....#.#.#...#.#...#...#...#...#.#...#.#.#.#.....#...#...#.#
|
||||
#.#.#####.#.#.###.#.#.#####.###.#####.###.#.#######.#############.#.#######.#####.###.#.#.#####.###.###.###.#####.#####.#.#.#.#.#.#.#####.#.#
|
||||
#.#.#.....#...#.#.........#.....#.#...#...#.#.......#.............#.#.....#.#...#...#...#.......#...#.....#.......#.....#...#.......#.....#.#
|
||||
#.#.#.#.#.#####.#######.#.#.#####.#.###.###.###.###.#.#####.#######.#.###.###.#.###.#####.#.#####.###.#.#######.#.#.###########.#.###.###.#.#
|
||||
#...#.#.....#...........#.#...#.#.....#.#.....#...#.......#...#...#...#...#...#...#.#.#...#.#.....#...#.........#...#...........#.....#...#.#
|
||||
#.#######.#.###.#.#####.#.###.#.#.###.#.#####.#.#.###########.#.#.#####.#.#.#####.#.#.#.#.###.#####.###.#.#.#####.###.#####.###.#.#####.#.#.#
|
||||
#.......#.#...#.#.#...#.#...#.#...#...#.#...#.#.#.......#.....#.#.....#...#.#...#.#.#...#.....#.....#...#.....#...#.....#...#...#...#...#...#
|
||||
#######.#####.#.#.#.###.#.#.#.#.#####.#.#.#.#.#.#######.#.#####.#.#######.#.#.#.#.#.#########.#.#.#####.###.#.#.#####.###.#.#.#.###.#.###.###
|
||||
#.....#.#...#.#.#.#.....#.#.............................#.#...#.#.#.......#.#.#...#...#.......#.........#.#...#.#.....#...#...#...#.#.....#.#
|
||||
#####.#.#.#.#.#.#.###.###.#.#.###.#.#.#####.###.#.#######.#.#.#.#.#.#####.#.#.#####.#.#.#####.#.#.#.###.#.#.###.###.#.#.###.###.#.#.#####.#.#
|
||||
#.....#...#...#.#...#.#...#.#.#...#.#.#.....#...#.....#.....#.#.#...#.......#.....#.#...#...#...#.....#.#.#.#.......#...#...#...#.#.#.....#.#
|
||||
#.###.#########.###.#.#.###.#.###.#.#.#.#####.#.#####.#######.#.#####.###.#######.#.#####.#.#.###.#.#.#.#.#.#########.###.#.#.#.###.###.#.#.#
|
||||
#.#.#.......#...#...#...#.#.#...#...#.#.#.#...#.....#.#.......#.....#.#.......#.#.#.......#.#.....#.#.#...#...#.......#.......#...#.....#...#
|
||||
#.#.###.#####.###.#######.#.###.#####.#.#.#.###.###.#.#.###########.#.#.#.###.#.#.###########.###.#.#.###.#.#.#.###.###.###.###.#.#.#####.#.#
|
||||
#.#.....#...#.#.#.#...........#.#.....#.#...#.....#.#...#.......#...#...#...#.#...............#...#.#...#...#.#...#.#...#...................#
|
||||
#.###.###.#.#.#.#.#######.###.#.#######.#.#####.#.#.#####.#####.#.#####.#.#.#.###############.#.#.#.###.###.#.###.#.#.#####.###.###.#.#.#.#.#
|
||||
#...#.#...#...#.#.......#.#.....#.......#.......#.................#...#.....#...#.....#.........#.....#.......#...#.#.#.....#...#...#.#.#...#
|
||||
#.#.###.#######.#######.###.#.###.#############.#.#########.#####.#.#.###.#####.#.###.#.###.#####.#.#######.###.###.#.#.#####.#.###.#.#.#.###
|
||||
#S#...................#...........#.......................#.........#...........#...#.....#.......................#.....#...........#.......#
|
||||
#############################################################################################################################################
|
||||
71
src/day16.scala
Normal file
71
src/day16.scala
Normal file
|
|
@ -0,0 +1,71 @@
|
|||
package aoc
|
||||
package day16
|
||||
|
||||
import scala.collection.{mutable => m}
|
||||
|
||||
val dayNumber = "16"
|
||||
|
||||
@main def part1: Unit =
|
||||
println(part1(loadInput(dayNumber)))
|
||||
|
||||
@main def part2: Unit =
|
||||
println(part2(loadInput(dayNumber)))
|
||||
|
||||
def part1(input: String): String =
|
||||
val maze = input.split("\n")
|
||||
maze.findLowestCost.toString
|
||||
|
||||
def part2(input: String): String =
|
||||
""
|
||||
|
||||
type Pos = (Int, Int)
|
||||
extension (pos: Pos)
|
||||
def x = pos._1
|
||||
def y = pos._2
|
||||
def +(dir: Dir): Pos = pos + dir.change
|
||||
def +(offset: Pos): Pos = (pos.x + offset.x, pos.y + offset.y)
|
||||
def abs: Pos = (Math.abs(pos.x), Math.abs(pos.y))
|
||||
def neighbors(curDir: Dir): Array[(Pos, Dir, Int)] =
|
||||
Dir.values.map(d => (pos + d, d, curDir.rotationCost(d) + 1))
|
||||
|
||||
enum Dir(val change: Pos):
|
||||
case Up extends Dir(0 -> -1)
|
||||
case Right extends Dir(1 -> 0)
|
||||
case Down extends Dir(0 -> 1)
|
||||
case Left extends Dir(-1 -> 0)
|
||||
import Dir.*
|
||||
|
||||
extension (dir: Dir)
|
||||
def rotationCost(to: Dir): Int =
|
||||
(dir.change + to.change).abs match
|
||||
case (0, 0) => 2000
|
||||
case (2, 0) | (0, 2) => 0
|
||||
case _ => 1000
|
||||
|
||||
type Maze = Array[String]
|
||||
extension (maze: Maze)
|
||||
def indices = for
|
||||
x <- maze.head.indices
|
||||
y <- maze.indices
|
||||
yield (x, y)
|
||||
|
||||
def findPos(c: Char): Pos = indices.find((x, y) => maze(y)(x) == c).get
|
||||
def getPos(pos: Pos): Char = maze(pos.y)(pos.x)
|
||||
|
||||
def findLowestCost: Int =
|
||||
val start = findPos('S')
|
||||
val end = findPos('E')
|
||||
val visited = m.Map.empty[(Pos, Dir), Int]
|
||||
val q = m.Queue((start, Right, 0))
|
||||
while q.nonEmpty do
|
||||
val (pos, dir, cost) = q.dequeue
|
||||
val prevCost = visited.get(pos -> dir)
|
||||
if prevCost.forall(_ > cost) then
|
||||
visited.update(pos -> dir, cost)
|
||||
q.enqueueAll(
|
||||
pos.neighbors(dir).collect {
|
||||
case (nPos, dir, nCost) if getPos(nPos) != '#' =>
|
||||
(nPos, dir, nCost + cost)
|
||||
}
|
||||
)
|
||||
visited.view.filterKeys(_._1 == end).values.toList.sorted.head
|
||||
Loading…
Add table
Add a link
Reference in a new issue