Compare commits
2 commits
bc585eec71
...
a9b53197e4
Author | SHA1 | Date | |
---|---|---|---|
a9b53197e4 | |||
e584957eb7 |
4 changed files with 335 additions and 0 deletions
141
16/input
Normal file
141
16/input
Normal file
|
@ -0,0 +1,141 @@
|
||||||
|
#############################################################################################################################################
|
||||||
|
#.......#.......#...#.....#...............#.....#...........#...............#.....#...#.....#.........#.#...#.....#.........#..............E#
|
||||||
|
#.#####.#####.#.#.#.#.###.#.#####.#########.###.#.###.#######.###########.#.###.#.#.#.#.#.#.###.#####.#.#.#.#.#.###.#####.#.#############.#.#
|
||||||
|
#...#.#.......#...#...#...#.#.....#...#.....#.#.#.#...#.....#.......#.....#.....#...#.#.#.#...#.#...#...#.#...#.....#...#.#.#.............#.#
|
||||||
|
###.#.#################.###.#.#####.#.#.#####.#.#.#.###.###.###.#####.###.###########.###.###.#.###.#.###.#############.#.#.#.#######.#######
|
||||||
|
#...................#...#...#.......#...#.....#.#.#...#...#.....#...#.............................#.#.#...#...#.......#.#.#...#.......#.....#
|
||||||
|
#.###.#.#########.###.###.#################.#.#.#.#######.#######.#.#.#####.###.#.#.###.#.#.#.#.#.#.#.#.#.#.###.###.#.#.#.#############.###.#
|
||||||
|
#.#.#.#.......#...#...#.#.#.........#.....#.#.#.#.....#...#...#...#...#...#.#.#.#.#...#...#.#.#...#.......#.#...#.#.#...#.................#.#
|
||||||
|
#.#.#.#######.###.#.###.#.#.#########.#.#.#.#.#.###.#.#.###.#.#.#######.#.#.#.#.###.#.#####.#.#.#########.#.#.###.#.#####################.#.#
|
||||||
|
#.#.........#...#.#...#.#.#.#...#.....#.#...#.#...#.#...#.................#...#...#.#.#.....#.#...#.....#.#...#...#...........#...#...#...#.#
|
||||||
|
#.#######.#####.#####.#.#.#.#.#.#.#####.#########.#.#####.#######.#.#####.###.###.#.#.#.###.#.#.#.#.###.#.#.#####.#####.#####.#.###.#.###.#.#
|
||||||
|
#.#.....#.#...#.........#.#...#.#.#.....#.........#.#...........#...#...#.....#...#.#...#...#.#...#.#.#...#.....#...#...#...#...#...#...#.#.#
|
||||||
|
#.#.###.#.#.#.#####.#####.#.#.#.#.#.###.#.#########.#########.#.#######.#####.#.###.#####.#.#.#.#.#.#.#####.###.#.#.#.###.#.#.###.#####.###.#
|
||||||
|
#.....#.#.#.#.....#...#...#.#...#.#...#.#.#.....#...#...#.....#.........#.....#...#.#.....#.#.................#...#.#.....#.#.#...#...#.....#
|
||||||
|
#.#####.#.#.#####.#####.###.#.###.###.###.#.#.###.###.#.#.###.#########.#####.###.#.#.#########.#.#.#######.#.#####.#######.###.###.#######.#
|
||||||
|
#.#...#.#.#.#...#.........#.#...#...#.#.....#.....#...#.#.#.......#.....#.....#.#.#.#...#.........#.....#.......#.........#.#...#...#.......#
|
||||||
|
#.#.#.#.#.#.#.###########.#.###.###.#.#.#######.###.###.#.#.#.###.#.#####.###.#.#.#####.#.#######.#####.#.#####.#.#########.#.###.#.#.#######
|
||||||
|
#.#.#...#.#.#.#.........#...#.#.....#.#.......#.....#.....#.#.....#...#.....#...#.#.....#...#.#.........#.#.....#.#.........#.#...#.#.....#.#
|
||||||
|
#.#.#.#####.#.#.###.###.#.###.#######.###.###.###############.#.#####.###.#.#.###.#.###.###.#.#.#########.#.#.#.###.#########.#.###.#####.#.#
|
||||||
|
#.#.#.#.....#...#...#...#.#.........#.......#.....#...#.....#.......#...#...#.#...#.#.....#.#.#...#...#...#.#.#...#.....#.....#...#.....#.#.#
|
||||||
|
#.#.###.###.###.#.#######.#.###.###.#####.#.#####.#.#.#.###.#.#####.###.#.###.#.###.#####.#.#.###.#.#.#.#####.###.#####.#.#######.###.#.#.#.#
|
||||||
|
#.#...#.......#...#.......#...#...#.#.....#...#.#...#.#...#.#...#.....#.#.....#...#...#...#.....#...#...#...#...#.....#.#.#...#...#...#.#.#.#
|
||||||
|
#.###.#####.#.#.###.#########.###.###.#######.#.#####.###.#.#####.###.#.#.#.#####.#.#.#########.#########.#.#.#.#####.#.#.#.#.###.#.#####.#.#
|
||||||
|
#.#.....#...........#.......#...#...#.....#...#.......#...#.....#.....#...#.....#.#.#.#.......#.#.........#...#...#...#...#.#...#.#.....#...#
|
||||||
|
#.#.#####.#.###.#.###.#####.#####.#.###.#.#.#######.#.#.#######.###.#####.###.#.#.#.#.#.#.#####.#.#.###############.###.#.#.###.#.###.#.###.#
|
||||||
|
#...............#.#.#.....#.....#.......#.#...#...#.#...#...#...#...#.........#.#.#.#.#.#.......#.#.#...#.........#.....#.#...#.#.....#.....#
|
||||||
|
#.#########.###.#.#.#.###.#####.#.#.#.#.#.###.#.#.#.#####.###.###.###.#####.#####.###.#.#####.#.###.#.#.#.#######.#####.#.#.###.###.#.###.###
|
||||||
|
#.....#...#.#.#...#.....#.....#.#.#.#.#.#...#...#.........#...#.......#...#.#...#...#.#.#.....#.....#.#...#...#.......#.#...#...........#...#
|
||||||
|
#####.#.#.#.#.#####.#####.#.###.#.#.#.#.###.#.#####.###.###.###.#######.#.###.#.#.#.#.#.#.###.#####.#.#######.#.#####.#.#####.###.###.#.#####
|
||||||
|
#...#.#.#.#...#.#...#.....#...#...#...#...#.#.#.......#.#...#...#...#...#.#...#.#.#.#...#...#...#...#.#.......#...#...#.....................#
|
||||||
|
#.#.#.#.#.###.#.#.###.#####.#.###########.#.###.#####.#.#.###.###.###.###.#.###.###.#######.#####.###.#####.#####.###.#.#.#.###.###.#.#####.#
|
||||||
|
#.#...#.#.....#.....#.#.....#.......#...#.........#...#.#.#...#.#...#...#...#.#...#.#.....#...#...#.#.....#...#...#.....#.#...#.#...#.....#.#
|
||||||
|
#.#####.#############.#####.###.###.###.#.###.#####.#####.#.###.#.#.###.###.#.#.#.#.#.###.#.#.#.###.#####.#.#.#.#.#.#####.###.#.#.###.###.#.#
|
||||||
|
#.#...#.......#.....#.....#.#...#.#.#...#...#.......#.....#.#.....#...#.#.......#.#.#.#.#.#.#.#.#...#.....#.#.#.#.#.#.......#.....#.......#.#
|
||||||
|
#.###.#######.#.###.#.###.#.#.###.#.#.#.#.###.###.###.#####.#.#######.#.#.#####.#.#.#.#.#.###.#.#.#.#.###.#.#.#.###.#######.#.#####.#.#####.#
|
||||||
|
#.#...#.....#...#.#.#...#...#.#.......#.#.#...#...#...#.#.....#.....#.#...#...#...#.....#.#...#...#...#...#.#.#...#.....#...#...#...#.#.....#
|
||||||
|
#.#.###.#.#######.#.#####.###.#####.#####.#.#####.#.###.#.###.#.###.#.#####.###.#.#####.#.#.#####.#####.#####.###.#.###.#.###.#.###.#.#.###.#
|
||||||
|
#.#.....#.#.......#...#...#...#...#.#.....#.....#.#...#.#...#.#.#.#...#...#.....#.....#.#.#.......#.........#.#...#.....#...#.........#...#.#
|
||||||
|
#.#.#####.#.###.#####.#.###.###.#.###.#########.#.###.#.###.###.#.###.#.#.#.#########.###.#########.#######.#.#.###.#####.###.###.#.#.#.#.###
|
||||||
|
#.#.#...#.#.#.......#.#.#.......#...#.........#.#.#...#.....#...#.....#.#.#.#.....#.#...#...#.........#...#...#.#...#.....#...#.#...#...#...#
|
||||||
|
#.#.#.#.#.#.#.#####.#.#.#######.###.#.#######.#.#.#.###.#####.#######.#.#.#.#.###.#.###.###.#.#########.#.#####.#.###.#####.###.###.###.###.#
|
||||||
|
#.#.....#.........#.#.#...#...#...#...#.....#.#.#.#.#.........#.....#...#.#...#...#...#.#...#.#.....#...#.#...#...#.#.#.#...#...........#.#.#
|
||||||
|
#.###.###########.#.#.###.#.#.###.#####.###.#.#.#.#.###########.###.###.#######.###.###.#.###.###.#.#.#.#.#.#.#.###.#.#.#.###.###.#.#.#.#.#.#
|
||||||
|
#.........#.......#.....#...#.#.#.....#.#...#.#.#.#.......#...#...#.......#.....#...#...#.........#.#.#.#.#.#.#.#.....#.#.#...........#.....#
|
||||||
|
#####.###.#.###########.#####.#.#.#####.#.#####.#.#####.#.#.#.#.#####.###.#.#####.#.#.###.#########.#.#.#.#.#.#.#####.#.#.###.#####.###.#.#.#
|
||||||
|
#.......#.#.......#...#.......#...#.....#.....#.#.#...#.#.#.#...#...#...#...#.....#.#...#.....#.....#.#.#...#.#.....#...#...#...#...#.....#.#
|
||||||
|
#.###.###.#########.#.#########.###.#####.###.#.###.#.#.#.#.#####.#.###.#.###.###.#####.#######.#.###.#.#####.#####.#######.#.###.#.###.#.#.#
|
||||||
|
#...#...#.#.........#.#.......#.#...#...#.....#...#.#...#...#.#...#.#...#.....#...#.....#.......#.#.....#.....#...#.........#.#...#.........#
|
||||||
|
###.#.#.#.#.#########.#.###.#.#.#.###.###.#######.#.###.#.###.#.###.#.#.#######.###.#####.#####.#.#.#####.#######.###########.#.#######.#.#.#
|
||||||
|
#...................#.#...#.#.#.#.#.......#.......#.#.#.#.#...#.#.#...#.#...#.#...#.......#...#.#...#.....#.....#.........#...#...#.....#...#
|
||||||
|
#.###.#.#####.#####.#.###.#.#.#.#.#####.#####.###.#.#.#.#.###.#.#.#.#.#.#.#.#.###.###.#####.#.#######.###.#.###.#########.#.#####.#.###.#.###
|
||||||
|
#.....#...#.#...#...#.#...#.#.#.#.....#.....#.#...#.#...#...#.#.#.#.#.#...#.#...#.#.#.......#...#.....#...#...#.........#.#.......#.#...#.#.#
|
||||||
|
#.###.#.#.#.#.#.#####.#.###.###.#####.#####.#.#####.#.#####.#.#.#.#.#.#####.#.###.#.#.#########.#.###########.#########.#.#.###.###.#.#.#.#.#
|
||||||
|
#...#...#...#.#...#...#...#.....#.#...#.......#.....#.#.#...#.#.......#.#...#...#.#.#.#.......#...#...........#.........#.#.#...#...#.......#
|
||||||
|
###.#.#####.#.###.#.#####.#######.#.###.#.###.#.#####.#.#.###.#.#######.#.###.#.#.#.#.#.#####.###.#.#.#########.#########.#.#.###.#####.#.#.#
|
||||||
|
#.#.#.#...#.#.#.#...#...#.#.......#...#.#.#.#.#...#...#.....#.#.....#.....#...#...#.#...#...#.#...#.....#.....#.....#...#...#.......#.....#.#
|
||||||
|
#.#.#.###.#.#.#.#####.###.#.#.#####.#.#.#.#.#.###.#.###.###.#.#####.###.#######.###.#####.#.#.#.#.#####.###.#######.#.###.#.#####.#.#.#.#.#.#
|
||||||
|
#...#...#.#.......#.......#...#...#.#...#.#.....#.#...#...#.......#...#...#...#.....#...#.....#.#...#.......#.......#.#...#.....#.#...#.....#
|
||||||
|
#.#####.#.#.#####.#######.#.###.#.#######.#######.###.#.#########.###.###.#.#.#.#####.#.#.#####.###.#.#######.#######.#.###.###.#######.#.###
|
||||||
|
#.#.....#.#.#...#.......#.#...#.#.......#.#.....#.#...#.#.........#.#.#.#...#.#.....#.#.#.....#...#.#...#.............#...#...#.....#...#...#
|
||||||
|
#.#.#####.#.#.#########.#.###.#.#######.#.#.###.#.#.###.#.#####.###.#.#.#.###.#.###.#.#.###.#.#.###.###.#.#####.#########.###.#####.#.###.#.#
|
||||||
|
#.#.#...#.#.#.....#.....#...#.#...#.......#...#...#...#...#...#.....#.......#...#.#...#...#.#.#.......#.#.....#.........#...#...#...#.#...#.#
|
||||||
|
#.#.#.#.#.#.###.#.#.#######.#.###.#.#########.#.#####.#####.#.#####.#.###.#######.###.###.#.#.#########.#####.#.#######.###.###.#.#.#.#.###.#
|
||||||
|
#.#.#.#...#.#...#.#.#.......#...#.#.#.......#.#.#.....#.....#.....#...#...#.....#.......#.#.#...........#...#.#...#...#.......#.#.#...#.#...#
|
||||||
|
###.#.#.###.#.#####.#.#########.#.###.#####.#.#.#.#####.#######.#.###.#.#.#.###.#.#####.#.#.#############.#.#.###.###.###.###.#.#.#.###.#.#.#
|
||||||
|
#...#.......#...#...#.....#.....#.....#...#.#.#.........#...#...#...#.#.#.#...#.#.....#.............#.....#...#.........#.....#...#.....#.#.#
|
||||||
|
#.###.#########.#.#.#####.###.#.#######.#.#.#.###########.###.#.###.#.#.#####.#.#####.#####.#########.#######################.#.#.#.#####.#.#
|
||||||
|
#.#...........#.#.#...#.#...#.#.........#...#.......#.....#...#.......#.....#.#.....#.#.....#...#.....#...#.......#.....#...#.#.#.#.....#.#.#
|
||||||
|
#.###########.#.#.#.#.#.###.#.#########.###.#######.#####.#.#############.###.#####.#.#######.#.#.###.#.###.###.#.#.###.#.#.###.#.#######.###
|
||||||
|
#...........#.#.#...#.#.....#.......#...#.....#...#.#...#...........#...#...#...............#.#.#...#.#.....#...#...#...#.#.....#.......#...#
|
||||||
|
#####.#.#####.#.#####.#.#####.#####.#.###.###.#.#.#.#.#.#####.#######.#.###.###.#.###.#.###.#.#.###.#.#.#####.#######.###.#############.###.#
|
||||||
|
#.....#.#...#.#.....#.#...#.......#.#.#...#...#.#.#...#...#.....#.....#.#.....#.......#.#...#.#.#...#.#.#...#...#.....#...#...#.....#.#...#.#
|
||||||
|
#.#####.#.#.#.#.###.#.###.#.#####.#.#.#.###.###.#.#######.#.###.#.#######.#####.#.#####.#.###.#.#.###.#.#.#####.#.#####.###.#.#.###.#.###.#.#
|
||||||
|
#...#...#.#...#...#.#...#...#...#.#.#.#...#...#.#.....#...#.#.#...............#.......#.#.#...#.#.#...#.#.....#.#.......#...#...#.......#.#.#
|
||||||
|
###.#.#.#.#######.#####.#.###.#.###.#####.###.#.###.#.#.#.#.#.#.###.#########.#######.#.#.#.###.#.#.#.#.#####.#.#########.#######.#######.#.#
|
||||||
|
#...#.#...........#.....#...#.#.....#.....#.#.#.#...#.#.#.#.#.......#.......#.......#...#.#...#...#.#...#.....#.....#...........#...#.....#.#
|
||||||
|
#.###.#########.###.#######.#.#.#.###.#####.#.###.#####.###.#######.#.#####.#.#####.#####.#.#.#########.#.#######.#.#.#########.###.#.#####.#
|
||||||
|
#...#...........#...#.....#...#.#.#...#...#.......#...#.#...#.....#.#...#.#.#.....#...#.#.#.#.#.......#...#.....#.#.#...#.....#.#...#.#.....#
|
||||||
|
#.#.#########.###.###.#########.#.#.#.#.#.#######.#.#.#.#.###.###.#.###.#.#.#####.#.#.#.#.###.#.###.#.#.###.###.#.#.###.###.#.#.###.#.#.###.#
|
||||||
|
#.#.........#.#...#...............#...#.#.....#...#.#...#.....#.#.#...#.#...#...#.#.#...#.....#...#.#.......#...#.#.......#.................#
|
||||||
|
#.#########.###.#########.#.#########.#.#####.#####.###.#######.#.#####.#.###.#.###.#.#.###########.#########.#####.#.###.#.#####.###.###.#.#
|
||||||
|
#...#.....#...#.#.......#...#.....#...#.....#.....#.#...........#.#.....#.....#.....#.............#.....#...#.#...#.#...#.#.#...#...#.#...#.#
|
||||||
|
###.#.###.###.#.#.#.###.#.###.###.#.#######.#####.#.###.#######.#.#.#############################.#####.#.#.#.#.#.#####.#.#.#.#.###.#.#.#.#.#
|
||||||
|
#.#...#...........#.#...#.#.#.#...#.........#.#...#.....#.........#.#...#.....#...#...#.........#.......#.#.#...#.#.....#.#...#.#...#...#.#.#
|
||||||
|
#.#####.###.#.#####.#.###.#.#.#.#########.#.#.#.#.#####.#.#########.#.###.#.#.###.#.#.#.#.#.#############.#.#####.#.#####.#####.#.#######.#.#
|
||||||
|
#.......#...#.........#.....#...........#.....#.#.....#.#...#.....#.#.....#.#...#...#.#.#.#.#.....#.....#.#.#...#.#...#...#.....#.........#.#
|
||||||
|
#.#####.#.#.#############.#.#.#########.#####.#.#####.#.###.#.#.#.#.#######.###.#.###.#.#.###.#.#.#.#.#.#.#.###.#.###.#.###.###.#####.#####.#
|
||||||
|
#...#...#.#.............#...#.....#.....#.....#.#.....#.....#.#.#...#.......#...#.#...#.#...#.#.#.#.#.....#.....#.....#.#...#.#...#...#...#.#
|
||||||
|
###.#.#.#.###########.#.#########.#.#######.###.#######.#####.#.#####.#######.#.#.#.###.###.#.#.#.#.#.#################.#.###.###.#.###.#.#.#
|
||||||
|
#.....................#...#.....#.#.......#...#.......#.....#.#.#.....#.....#.#...#.#...#...#.#.#.#.#.#...............#.#.#.#...#.#.....#.#.#
|
||||||
|
#.###.#.#.###.###########.#.###.#.#######.#####.#####.#.#.#.###.#####.#.#####.#.###.#.###.###.#.###.#.#.#########.#####.#.#.#.#.#.#######.#.#
|
||||||
|
#...#...#.#...#.........#...#...#.......#.....#.....#...#.#...#.....#.#...#...#.#...#.#.#.....#.....#...#.......#.....#.......#.#...#.#...#.#
|
||||||
|
###.###.#.#.###.#######.#####.#########.#####.#######.#.#.###.#####.#.#.#.#.#####.###.#.#############.#####.#.#.#####.#####.###.###.#.#.###.#
|
||||||
|
#.#...#...#.#...#.....#.#...............#...#.....#...#.#.#.#.......#.#...#.#...#...#.....#.......#.......#.#.#.........#...#.#...#.#.#.#...#
|
||||||
|
#.###.#.###.#.#######.#.#.#.#############.#.#.###.#.#.#.#.#.#########.#.###.#.#.###.#####.#####.#.#####.#.###.#####.###.#.###.#.###.#.#.#.###
|
||||||
|
#.....#...............#.#.#.....#.....#...#.....#...#...#.#...........#.......#.......#...#.....#.......#.....#...#.#.#...#...#...#.#.#...#.#
|
||||||
|
#.#############.#####.#.###.#.###.#.###.#.#####.#####.###.#.#.#########.###############.###.###################.#.#.#.#######.###.#.#.#####.#
|
||||||
|
#.#.......#...#.#.....#...#.#.....#.#...#.#...#.....#.#...#.#.#.............#...........#.#...#...#.........#...#.#.#...#.......#.#.#.......#
|
||||||
|
#.###.###.#.#.#.#.#.###.#.###.#####.#.###.###.#.###.#.#.#.#.###.#.#.#########.#######.###.#.#.###.#.#####.#.#.###.#.#.#.###.###.#.#.#.#####.#
|
||||||
|
#.....#...#.#.#.#.#...#.#...#.....#...#...#.......#.#.#.#.#.....#.#...........#.#...#.......#.........#.#.#...#...#...#.....#...#.#...#.#...#
|
||||||
|
#######.###.#.###.###.#####.#.###.#####.###.#######.#.#.#.#.#.###.#.###########.#.#.#.###.#.###.#####.#.#.#####.#############.###.#####.#.###
|
||||||
|
#.....#.#...#.#...#.........#...#.....#...#.........#.#.#...#.......#.....#...#.#.#.#.#...#...#...#.#.#.#.#...#...#.....#...#...#.......#...#
|
||||||
|
#.#.###.#.###.#.#######.#.#####.#.###.###.###########.#.#.#######.#.#.###.#.#.#.#.#.#.#.#####.###.#.#.#.#.#.#.#.#.#####.#.#.###.#####.#####.#
|
||||||
|
#.#...#...#...#...#...#.#.....#.....#...#.#...........#.#.....#...#.#.#.#...#.#...#.#.#.#.......#.#.#.#.#...#.#.#.#.....#.#.....#...#.......#
|
||||||
|
#####.#####.###.#.#.#.#.###.#.#.###.#.#.#.#.###########.#####.#.###.#.#.#####.###.#.#.#.#.#######.#.#.#.#####.#.#.#.###.#.#######.#.#######.#
|
||||||
|
#.........#.#.#.#...#.#...#.#.#...#.#.#.#.#.#...........#.....#...#...#.....#...#.#...#.......#...#.#.#.....#.#.....#...#.#.................#
|
||||||
|
#.#####.###.#.#.#####.###.#.#.###.###.###.#.#.#.#########.#.#.###.#####.###.###.###.#########.#.###.#.#.###.#.#.#.#######.#####.#####.###.#.#
|
||||||
|
#.......#...#.#.....#.#...#.#.#.......#...#.#.#.#.......#.#.#.#...#.#...#.....#...#.#...#.....#...#.#...#...#.#.#.......#.#...#.#...#...#.#.#
|
||||||
|
#.#####.#.###.#####.#.#.#####.#.#####.#.###.###.#.#####.#.#.#.#.###.#.#.#.###.###.###.#.#########.#.#.#.#.#.#.###.#####.#.#.#.#.#.#.###.###.#
|
||||||
|
#.#...#.#.#.......#.#.#.......#.......#.#...#...#.....#...#.#.#.#.......#.#.#...#...#.#...#.......#...#...#.#.....#.......#.#...#.#.......#.#
|
||||||
|
#.#.#.###.#.#######.#.#########.#######.#.###.###.###.#######.#.#.#####.#.#.###.###.#.###.#.#######.###.#.#########.#.#####.#############.#.#
|
||||||
|
#...#...#.#.........#.#...........#.#...#.....#.#...#.......#...#.....#...#...#...#.#...#...#.....#...#.#.....#...#.#.....#...........#...#.#
|
||||||
|
#.#####.#.#########.#.#####.#####.#.#.#########.###.#######.#########.#####.#.#.###.#.#.#####.#.#.###.#.###.#.#.#.#####.###.#########.#.###.#
|
||||||
|
#.#...#.#.#.......#.#.#.....#...#.#.#.......#.....#.#.....#...#...#...#.....#.#.#...#.#.#.....#.....#.#...#.#...#.#...#.#...#.........#...#.#
|
||||||
|
#.###.#.#.#.#.###.###.#.###.#.#.#.#.###.###.###.###.#.###.#.###.#.#.#####.#####.#.#####.#.#####.#####.#####.#####.#.#.#.#.###.###########.#.#
|
||||||
|
#.....#.#...#...#.....#.#...#.#.......#.#.#.....#...#.#...#...#.#.#.#.....#...#...#...#.#.#.#...#...#.....#.........#...#.#.#...............#
|
||||||
|
#####.#.#####.#########.#####.#########.#.#.#####.###.#######.#.#.#.#.###.#.#.#####.#.#.#.#.#.###.#.#####.#####.#######.#.#.#.#.#.#.###.#.#.#
|
||||||
|
#...#.#...............#.........#.......#...#.....#...#.....#...#.#.#...#.#.#.......#.#.#.#.#.....#.......#.....#...#...#...#...#.#.#...#.#.#
|
||||||
|
#.###.#.#.#.#.#.#####.#.#########.#######.###.#####.###.#.#####.#.#.#.#.###.###.#####.#.#.#.###.#####.#.#.#.###.#.#.#.#####.#####.#.#####.#.#
|
||||||
|
#.#...#.#.#...#.#...#.#...#.#.....#.......#.#.#...#...#.#...#.....#.#.#.......#.#.#...#.#...#.......#.#.#.#.#.#.#.#.#.#.....#.....#...#.....#
|
||||||
|
#.#.#.#.#.###.#.#.#.#####.#.#.###########.#.#.#.#.###.#.###.#.#.###.#.#########.#.#.###.###.#####.###.###.#.#.#.#.#.###.#####.#######.#.###.#
|
||||||
|
#.#...#...#...#.#.#.#.....#.#...#.......#...#...#...#...#...........#.#.........#.......#.#.#...#...#.....#.#...#.#.#...#.....#...#...#...#.#
|
||||||
|
#.###.#####.#.#.#.#.#.#####.###.#.#####.###########.#####.#############.#######.#########.#.#.#.###.#######.#####.#.#.###.#####.#.#.#####.#.#
|
||||||
|
#.#...#.....#.#.....#.........#.....#...#.........#.....#.#.....#.....#.......#.#...#.....#...#.......#...........#.....#...#...#.#.....#...#
|
||||||
|
#.#.#.#.#####.#.###.###.#############.###.###.#####.###.#.#.###.#.#.#.#.#.###.###.#.###.#.###########.#.#########.#########.#.###.###.#.###.#
|
||||||
|
#.#...#...........#.....#...#.......#...#.#.#.......#...#.....#...#.#...#...#...#.#...#...........#...#.#...#...#.#.......#...#...#...#.#...#
|
||||||
|
#.###.#.###.#.###########.#.#.#.###.###.#.#.#####.###.###.#########.###.#####.#.#.#.#.###.#######.#.#####.#.#.#.###.#####.#.###.###.#.###.###
|
||||||
|
#.#...#...#...#.....#...................#.......#...#.#...............#.#...#.#...#.#...#.....................#.....#.....#...#...#.#.#...#.#
|
||||||
|
#.#.#.###.#.#.#.###.#.###.#####.#.###.###.#######.#.#.#####.#########.#.#.#.#.#####.###.#.#.###.#####.#####.#########.#######.###.#.#.#.###.#
|
||||||
|
#.#.#...............#...#.#...#...#.......#.....#.#.#.....#.................#.........#.#.......#.......#.......#...#...#.....#...#.#.#.#...#
|
||||||
|
#.#.#.#######.#.#.#####.###.#.###.###.#####.###.###.#####.#.#.#####.###.#.#.###########.#.#.###.#######.#.#.#####.#.###.###.###.###.#.#.#.###
|
||||||
|
#...#...#.#.....#.....#.#...#...#...#...#...#...........#.#.#.#...#.#.........................#.........#.#.......#...#...#...#...#.#.#.#...#
|
||||||
|
#.#.###.#.#.#########.#.#.#####.###.#####.###.###########.###.#.#.#.#.###.#.#.###.#.#.#.#.#.#.###########.#.#####.#.#.#.#.#######.#.###.#.#.#
|
||||||
|
#.#...#.#...#.......#.#.#.....#...#.......#.....#.......#...#...#.#.#.#...#.#.#.#...#.#.#.#.#.................................#.....#...#.#.#
|
||||||
|
#.#.#.#.#####.#####.#.#.#.#####.#.###############.#####.###.#####.#.#.#.###.#.#.#####.#.#.#.#####.#.#.#.###.#.#.###.###.#####.#.###.#.#####.#
|
||||||
|
#.#...#.....#.#.....#...#.#.......#.....#.............#...#.....#.#.#.#.#.#.....................#.#...#...#...#...#...#.#...#...#...#.....#.#
|
||||||
|
#.#.#.#####.#.#.###.###.#.#.###.#.#.###.#.#############.#######.#.#.#.#.#.#.#.###.#######.#.#.#.#.#######.#.#####.#.#.#.###.#####.#.#####.#.#
|
||||||
|
#...#...#...#.#...................#...#.#...#...........#.......#.#...#.#.#.#...#.#.......#.....#...#...#...#.....#.#.#.....#.....#.....#.#.#
|
||||||
|
###.###.#.###.#.#.#######.#.###.#####.#.###.#.###########.#######.#.###.#.#.###.#.###.###.#.###.#####.#.#####.#####.#.#######.#.#########.#.#
|
||||||
|
#S......#.......#.........#...........#.....#.....................#.....#.......#.....#.....#.........#.......#.....#.........#.............#
|
||||||
|
#############################################################################################################################################
|
109
16/main.rb
Executable file
109
16/main.rb
Executable file
|
@ -0,0 +1,109 @@
|
||||||
|
#!/usr/bin/env ruby
|
||||||
|
|
||||||
|
require "debug"
|
||||||
|
require "matrix"
|
||||||
|
|
||||||
|
@input = (ARGV.first.nil? ? DATA : ARGF)
|
||||||
|
.readlines(chomp: true)
|
||||||
|
.map(&:chars)
|
||||||
|
start = [@input.flatten.index { _1 == "S" }]
|
||||||
|
.map { Vector[_1 / @input.size, _1 % @input.first.size] }
|
||||||
|
.first
|
||||||
|
finish = [@input.flatten.index { _1 == "E" }]
|
||||||
|
.map { Vector[_1 / @input.size, _1 % @input.first.size] }
|
||||||
|
.first
|
||||||
|
|
||||||
|
NORTH = Vector[-1, 0]
|
||||||
|
EAST = Vector[0, +1]
|
||||||
|
SOUTH = Vector[+1, 0]
|
||||||
|
WEST = Vector[0, -1]
|
||||||
|
DIRECTIONS = [NORTH, EAST, SOUTH, WEST]
|
||||||
|
|
||||||
|
class PriorityQueue < Array
|
||||||
|
alias extract_min shift
|
||||||
|
alias peek first
|
||||||
|
|
||||||
|
def <<(v)
|
||||||
|
unless v.is_a?(Array)
|
||||||
|
raise ArgumentError, "PriorityQueue requires array with priority as last"
|
||||||
|
end
|
||||||
|
|
||||||
|
super
|
||||||
|
sort_by!(&:last)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def dijkstra(graph, start, start_direction, target)
|
||||||
|
dist = Hash.new # scores
|
||||||
|
prev = Hash.new
|
||||||
|
queue = PriorityQueue.new
|
||||||
|
|
||||||
|
queue << [start, start_direction, 0]
|
||||||
|
dist[[start, start_direction]] = 0
|
||||||
|
# alternate only inserting source and add nodes inside score check later
|
||||||
|
|
||||||
|
until queue.empty?
|
||||||
|
position, direction, score = queue.extract_min
|
||||||
|
|
||||||
|
neighbors = DIRECTIONS.each do |new_direction|
|
||||||
|
neighbor = position + new_direction
|
||||||
|
|
||||||
|
next if neighbor == position || graph.dig(*neighbor) == "#"
|
||||||
|
|
||||||
|
new_score = score + 1 + (direction == new_direction ? 0 : 1) * 1_000
|
||||||
|
|
||||||
|
if dist[[neighbor, new_direction]].nil? || new_score < dist[[neighbor, new_direction]]
|
||||||
|
dist[[neighbor, new_direction]] = new_score
|
||||||
|
prev[[neighbor, new_direction]] = [[position, direction]]
|
||||||
|
|
||||||
|
queue << [neighbor, new_direction, new_score]
|
||||||
|
elsif new_score == dist[[neighbor, new_direction]]
|
||||||
|
prev[[neighbor, new_direction]] << [position, direction]
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
return dist, prev
|
||||||
|
end
|
||||||
|
|
||||||
|
def seats(dist, prev, target)
|
||||||
|
visited, queue = Array.new, Array.new
|
||||||
|
|
||||||
|
lowest_score = dist.keys.select { |(pos, dir)| pos == target }.map { dist[_1] }.min
|
||||||
|
dist
|
||||||
|
.select { |(position, _), score| position == target && lowest_score == score }
|
||||||
|
.each { queue << _1.first }
|
||||||
|
|
||||||
|
until queue.empty?
|
||||||
|
directional_location = queue.pop
|
||||||
|
visited << directional_location.first
|
||||||
|
unless prev[directional_location].nil?
|
||||||
|
queue.concat(prev[directional_location])
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
return visited.uniq
|
||||||
|
end
|
||||||
|
|
||||||
|
dist, prev = dijkstra(@input, start, EAST, finish)
|
||||||
|
part_1 = dist.keys.select { |(pos, dir)| pos == finish }.map { dist[_1] }.min
|
||||||
|
p part_1
|
||||||
|
part_2 = seats(dist, prev, finish)
|
||||||
|
p part_2.size
|
||||||
|
|
||||||
|
__END__
|
||||||
|
###############
|
||||||
|
#.......#....E#
|
||||||
|
#.#.###.#.###.#
|
||||||
|
#.....#.#...#.#
|
||||||
|
#.###.#####.#.#
|
||||||
|
#.#.#.......#.#
|
||||||
|
#.#.#####.###.#
|
||||||
|
#...........#.#
|
||||||
|
###.#.#####.#.#
|
||||||
|
#...#.....#.#.#
|
||||||
|
#.#.#.###.#.#.#
|
||||||
|
#.....#...#.#.#
|
||||||
|
#.###.#.#.#.#.#
|
||||||
|
#S..#.....#...#
|
||||||
|
###############
|
5
17/input
Normal file
5
17/input
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
Register A: 17323786
|
||||||
|
Register B: 0
|
||||||
|
Register C: 0
|
||||||
|
|
||||||
|
Program: 2,4,1,1,7,5,1,5,4,1,5,5,0,3,3,0
|
80
17/main.rb
Executable file
80
17/main.rb
Executable file
|
@ -0,0 +1,80 @@
|
||||||
|
#!/usr/bin/env ruby
|
||||||
|
|
||||||
|
input = (ARGV.first.nil? ? DATA : ARGF)
|
||||||
|
.readlines(chomp: true)
|
||||||
|
split = input.index("")
|
||||||
|
|
||||||
|
registers = input[...split]
|
||||||
|
.map { _1.split(": ").last.to_i }
|
||||||
|
.zip(%i[A B C]).map(&:reverse)
|
||||||
|
.to_h
|
||||||
|
program = input[split+1].split(" ").last.split(",").map(&:to_i)
|
||||||
|
|
||||||
|
def execute(registers, program)
|
||||||
|
stdout, ic = Array.new, 0
|
||||||
|
|
||||||
|
combo = ->(operand) { operand < 4 ? operand : registers.values[operand - 4] }
|
||||||
|
|
||||||
|
while ic < program.size
|
||||||
|
opcode, operand = program[ic], program[ic + 1]
|
||||||
|
ic += 2
|
||||||
|
|
||||||
|
case opcode
|
||||||
|
when 0 then registers[:A] = registers[:A] / 2 ** combo.(operand)
|
||||||
|
when 1 then registers[:B] = registers[:B] ^ operand
|
||||||
|
when 2 then registers[:B] = combo.(operand) % 8
|
||||||
|
when 3 then registers[:A] == 0 || ic = operand
|
||||||
|
when 4 then registers[:B] = registers[:B] ^ registers[:C]
|
||||||
|
when 5 then stdout << combo.(operand) % 8
|
||||||
|
when 6 then registers[:B] = registers[:A] / 2 ** combo.(operand)
|
||||||
|
when 7 then registers[:C] = registers[:A] / 2 ** combo.(operand)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
stdout
|
||||||
|
end
|
||||||
|
|
||||||
|
part_1 = execute(registers.dup, program).join(",")
|
||||||
|
p part_1
|
||||||
|
|
||||||
|
def reverse_engineer(program, slot, candidate)
|
||||||
|
return candidate if slot < 0
|
||||||
|
|
||||||
|
candidate <<= 3 unless slot == program.size - 1
|
||||||
|
|
||||||
|
(0..7)
|
||||||
|
.map { [candidate + _1, execute({A: candidate + _1, B: 0, C: 0}, program)] }
|
||||||
|
.select { _1.last == program[slot..] }
|
||||||
|
.flat_map { reverse_engineer(program, slot - 1, _1.first) }
|
||||||
|
end
|
||||||
|
|
||||||
|
p reverse_engineer(program, program.size - 1, 0).sort.first
|
||||||
|
|
||||||
|
# part_2 = 0
|
||||||
|
# (program.size - 1).downto(0) do |slot|
|
||||||
|
# candidates = []
|
||||||
|
# (0..8).each do |i|
|
||||||
|
# candidate = part_2 + i
|
||||||
|
# _, _, output = execute({A: candidate, B: 0, C: 0}, program)
|
||||||
|
# new_program = output.split(",").map(&:to_i)
|
||||||
|
#
|
||||||
|
# if new_program == program[slot..]
|
||||||
|
# candidates << candidate
|
||||||
|
# unless [301,2566855701950, 20534845615581, 20534845615573, 20534845615583].include?(candidate)
|
||||||
|
# part_2 = candidate
|
||||||
|
# end
|
||||||
|
# end
|
||||||
|
# end
|
||||||
|
# p candidates
|
||||||
|
# if slot == 0
|
||||||
|
# p candidates.first
|
||||||
|
# end
|
||||||
|
# part_2 <<= 3
|
||||||
|
# end
|
||||||
|
|
||||||
|
__END__
|
||||||
|
Register A: 117440
|
||||||
|
Register B: 0
|
||||||
|
Register C: 0
|
||||||
|
|
||||||
|
Program: 0,3,5,4,3,0
|
Loading…
Add table
Reference in a new issue