wip
This commit is contained in:
parent
4da51514aa
commit
1e68260c9d
141
2024/day16/input.txt
Normal file
141
2024/day16/input.txt
Normal file
@ -0,0 +1,141 @@
|
||||
#############################################################################################################################################
|
||||
#.............#...#...........#...#...................#.........#...........#...................................#.............#.......#....E#
|
||||
#.#####.#####.#.#.#.###.#####.#.#.#.#.#########.#####.#.#######.#.#########.#######.###.###.###.#.#######.#.###.#.#########.#.#####.#.#.#.#.#
|
||||
#.#...#...#.#...#.#...#.....#.#.#.#.#.....#.....#...#...#.......#...#.....#.....#...#.#.....#.#.#.#.....#.#...#.#.#.#.......#...#...#.#.#.#.#
|
||||
###.#.#.#.#.###.#.###.#.###.#.#.#.#.#.###.#.#####.#######.#########.###.#######.#.###.#######.#.#.#####.#.###.#.#.#.#.#########.#.###.#.#.#.#
|
||||
#...#.#.#.#...#.....#...#...#...#...#.#.#...#...#.......#.........#...#.........#.#.#.........#.#.......#.#...#.#.#.#.....#.....#.#...#.#.#.#
|
||||
#.###.###.#.###.#########.#####.#####.#.#####.#.#.#.#############.#.#.#####.#####.#.#.###.###.#.###.#####.#.###.#.#.#####.###.###.#.###.#.###
|
||||
#.#.......#.....#.....#...#.....#.....#.......#...#.............#.#.#.....#.#.....#.#...#...#.#.#...#.....#.#.#.#.....#.#...#...#.#.#...#...#
|
||||
#.#########.###.#.#.###.###.###.#.#####.#################.#######.#.#####.#.#.#####.###.###.#.#.###.#.#####.#.#.#####.#.###.###.#.###.#.#.#.#
|
||||
#.#...#.....#.#...#...#.#.#.#.#.#.........#.............#...#.....#.....#.#.#...#...#...#...#.#...#.#.#...#...#...........#.#.............#.#
|
||||
#.#.#.#####.#.#.#####.#.#.#.#.#.#######.#.#.#######.###.###.#.#######.###.#.###.#.#.#.#.#.###.###.###.#.#.###.###########.#.#.#####.###.#.#.#
|
||||
#...#.....#...#...#...#.#.#...#.........#...#.....#...#.#...#...#.#...#...#.....................#...#...#...#.......#...#.#.#.#.......#.#...#
|
||||
#.#######.#####.###.#.#.#.#.#####.#####.#####.###.#####.#.#####.#.#.###.#########.#.#.#.###.#######.#.#.#.#####.#####.#.#.#.###.#.#####.#.###
|
||||
#.#.....#.....#.#...#.#.#...#.....#...#.#.#...#.....#...#.....#.#...#...#.........#.#.....#.#.......#...#.......#.....#.#.#...#...#.....#...#
|
||||
#.#.###.###.#.#.#.###.#.#.###.#####.#.#.#.#.#######.#.#######.#.###.#.###.###########.#.###.#.###########.#######.###.#.#.###.#.#.#.###.#.#.#
|
||||
#...#.#.#...#...#.#...#.#...#.#.....#.#...#.....#.#...#.......#...#.#.#.#.......#.....#...#...#.........#...#.....#.#...#...#.#.#...#.....#.#
|
||||
#####.#.###.#####.#.###.#####.#.###.#.#.#.#####.#.#.#####.###.###.###.#.#.#####.#.#####.#.#.###.#######.#####.#####.#.###.###.#.#.###.#####.#
|
||||
#.....#.....#.....#...#.#.....#...#.#.#.....#.......#...#...#.#...#...#...#.......#.....#.#.#...#.............#.....#.#.#.#...#.#.#...#...#.#
|
||||
#.#########.#.#######.#.#.#########.###.#####.#######.#.###.###.###.###.###.###.#.#.#####.#.#.#.#.#######.###.###.###.#.#.#.###.#.#.###.###.#
|
||||
#.#.......#.#.......#.#...#.......#...#.#.........#...#...#...........#...#.......#.#...#.......#.........#.......#...#...#.....#.......#...#
|
||||
#.#.#.###.#.#######.#######.#####.###.#.#.#.#####.#.#####.#.#########.###.#########.#.#.#.###########.#.###.###.#.#.###.#########.#######.#.#
|
||||
#...#.#...#.#.....#.#.......#.........#.#.#.....#...#.....#...#.....#...#.#...#.....#.#.#...#.......#...#...#...#.....#.....#.......#.....#.#
|
||||
#####.#.###.#####.#.#.###.###.#######.#.#.#####.#.###.#######.#.###.#.#.#.#.###.#.###.#.###.#######.#####.###.###.###.#####.#####.#.#.#####.#
|
||||
#.....#...#.....#.#...#...#...#.......#.#.#.....#.#...#...#...#.#...#.#.....#...#.....#...#.......#.....#...#.#.....#...#.#.........#.....#.#
|
||||
#.#.#######.###.#.#####.###.#.#.#######.#.###.#####.###.#.#####.#.###.#.#####.###.#######.#######.#.#.###.#.#.#########.#.#####.#.#######.#.#
|
||||
#.#.#...........#...#...#...#...#.....#.#...#.......#...#.......#...#.....#...#.#...#...........#.#.#...........#.....#.#.#.....#.........#.#
|
||||
#.#.#.#####.#######.#.#####.#####.###.#.###.#####.###.###########.#.#######.###.#.#.###.#####.###.#.###.#.#.###.#.###.#.#.#.###.#.#########.#
|
||||
#.#.#...............#.....#.#.....#...#...#...#...#...#...#.....#.#...........#.#.#.....#.....#...#.#.#.....#...#...#.....#.#.....#.....#...#
|
||||
#.#.#.#.#.#.#######.#####.#.#.#####.#####.###.#####.#####.#.###.#.#######.###.#.#.#####.#.#####.###.#.#######.#.###.#.#.#.#.#.#.#.###.###.###
|
||||
#.#.#.#.#.#.......#.....#.#.#.....#.......#.#.....#...#...#...#.#.......#.#...#...#.....#.....#.#...#.......#.#...#.#.#.#...#.#.....#.......#
|
||||
#.###.#.###.#####.#######.###.#.###########.#.#.#.###.#.#####.#.###.#####.#.###.###.###.#######.#.#.#####.#.#.#####.#.#.#####.#.###.#######.#
|
||||
#.....#...#.....#...#...#...#.#.#.....#.....#...#...#.#.#.....#...#.#.....#.#.....#.#...#.....#.#...#...#.#.#.......#.........#...#.......#.#
|
||||
#.#######.#.###.###.#.#.###.#.#.#.#.###.#.#.#####.###.#.#.#######.#.#.###.#.#####.#.###.#.###.#.#.###.#.#.#.#######.#########.#.#.#######.###
|
||||
#.....#...#.....#.#...#...#.#.#.#.#.....#.#...#...#...#.#.....#.#.#.#...#.#...#...#...#.#.#...#.#.#...#.#.#...#...#.#.....#.............#...#
|
||||
#####.#.#.#.#####.#######.#.#.#.#.#######.###.#.###.###.#####.#.#.###.#.#####.#######.###.#.###.#.#.###.#.###.#.#.###.###.#.###.###.#######.#
|
||||
#.#...#.#.#.#...#...........#.#...#...#.#...#.#...#...#...#.#...#...#.#.#...#.#.....#.#...#.....#...#.....#...#.#.....#.#.#.......#.#.....#.#
|
||||
#.#.###.#.#.###.#.###########.#.###.#.#.###.#.###.###.#.#.#.#.#.###.###.#.#.#.#.###.#.#.#############.#########.#######.#.###.#.###.#.###.#.#
|
||||
#...#...#.#.#...#.#...........#.....#.#.#...#...#...#...#.#.#.#...#.#...#.#.....#.....#.#...#.........#.........#.......#...#.#.....#.#...#.#
|
||||
#.###.#.###.#.###.#.#######.#.#######.#.#.#####.###.#####.#.#.#.###.#.#.#.#######.###.#.#.#.#####.#####.#########.#####.###.#.#.#####.#.###.#
|
||||
#...#.#...#.#.....#.#.....#...#...#...#.#.#.#.....#...#...#.#.#...#.#.#.#...#.......#.#...#.....#...#...#.....#...#...#...#.....#.....#.#...#
|
||||
###.#.###.#.#######.#.#########.#.###.#.#.#.#.###.#.###.###.#.#.#.#.#.#.###.#.#####.#####.#####.#.#.#.#####.#.#.#.#.#.###.###.#.#.#####.###.#
|
||||
#...#.#...#.........#...........#...#...#.#.......#.....#...#.#.#.....#.#...#.....#.#...#.#.........#.#.....#.#.#...#.....#...#.#.#...#.....#
|
||||
#.#.#.#.#########.#######.#########.###.#.#.#####.#######.###.###########.#######.#.#.#.###.#####.#.#.#.#####.#.#.#.#######.#.#.#.#.#.#####.#
|
||||
#.#...#.#...............#.....#...#.#.#.#.#...#.#...#.......#...#.........#.#...#.#...#.....#...#...#.#.#...#.#.#.#...#.#...#.#.#...#.#.#...#
|
||||
#.#.###.#.#######.#####.#.###.#.#.#.#.#.#.#.#.#.###.###.###.###.#.#########.#.#.#.#####.#####.#.#####.#.#.#.#.###.###.#.#.#####.###.#.#.#.###
|
||||
#.#...#...#.......#...#.#.#...#.#.#.#...#.#.#.....#...#.#...#...#...#.#.......#.#...#...#.....#.........#.#.#.....#.......#...#.#.........#.#
|
||||
#.#.#######.#########.#.#.#.#####.#.###.#.#.#####.###.#.#.#.#.#.###.#.#.#######.###.#####.#########.#####.#.#######.#####.#.#.#.#.#.###.###.#
|
||||
#.#.#.....#.....#.....#.#.#.....#.#...#.#.#.....#.#...#...#.#.#.#...#.....#.....#...#...#.#...#.....#.....#...#.....#...#...#...#.....#.#...#
|
||||
#.#.#.#.#.#####.#.#####.#.#####.#.#.#.#.#.#.###.###.#######.#.#.#.###.###.#.###.#.#.#.#.#.#.#.#.###.#######.#.#.#####.#.###########.#.#.#.#.#
|
||||
#.#.#.#.................#.....#.#.#...#.#.#...#.....#.......#.#.#.#.....#.#.#...#.#.#.#...#.#.#.............#.#.#...#.#.........#.....#.#.#.#
|
||||
#.#.#.#.#########.###.###.#####.#.#.#####.#.#####.###.#.#.###.###.#.#.#.###.#.###.###.#####.#.#.#.#############.###.#.#######.#.#.#.###.#.#.#
|
||||
#.#.#.....#.....#.#.......#.....#.#.#.....#.#...#.....#...#...#...#.#.#.#...#...#.....#.....#.#...#...........#.#...#.#.....#.............#.#
|
||||
#.#.###.#.###.###.###.#.###.#####.#.#.#######.#.#######.###.#.#.#####.#.#.#####.###########.#.#.###.#########.#.#.###.#.#.#.#.###.#.#.###.#.#
|
||||
#.#.....#.......#...#...#.#.#.....#.#.#...#...#.......#...#.#.........#.#...#.#...#.........#.#.........#...#.#.#...#.#.#.#.#...#.#.#...#.#.#
|
||||
#.#.###.###.###.#.#.###.#.#.###.#.#.#.#.#.#.#######.#.###.#.###.###.###.###.#.#.#.###.#######.#######.###.#.#.#.###.#.#.#.#.###.#.#.#.###.#.#
|
||||
#.#...#.....#...#.#...#...#.#...#.#.#...#.#.......#.....#.#.#...#...#.#.........#...#.#.......#.....#.#...#.#.....#.#...#.#...#...#.#.....#.#
|
||||
#.#.#.#.#####.#.#.###.#####.#.#####.#.###.#######.#.#.###.#.#.###.###.#########.###.#.#.#######.###.#.#.###.#####.#.#####.#.#######.#.#####.#
|
||||
#.#.#.#.#.....#.....#.......#.#.....#...#...#...#.#.#.....#.#.#...#.....#.........#...#...#.....#.#.#...#.#...#.......#...#.................#
|
||||
#.#.#.#.#####.###############.#.#######.#.#.###.#.#.###.###.#.#.#######.#.#.###########.###.#####.#.###.#.###.#########.#############.#######
|
||||
#...#.#.....#...#.......#...#...#.......#.#...#.#.#...#.#.....#.#.......#.#.#.......#...#...#.....#...#.#...#.................#.....#.......#
|
||||
###.#.#.###.#.#.#.#.###.###.#.#######.###.###.#.#.###.###.###.#.###.#.###.#.#.#.#.#.#.###.###.#######.#.#.#.#########.###.###.#.###.#.#####.#
|
||||
#...#.#.#.#.#.#...#...#.....#.#.....#.#...#.#.#.#.#.#...#.#...#...#.......#...#...#.#.#.#.#.........#.#.#.#.#.......#.....#.#...#.#.#...#.#.#
|
||||
#.#.#.#.#.#.#########.#####.#.#.###.###.###.#.#.#.#.###.#.#.#####.#.###########.###.#.#.#.###.#.#.#.#.#.###.#.#.###.###.#.#.#####.#.#.#.#.#.#
|
||||
#.#.#.#...#.#.......#...#...#...#.#...#.#.......#...#.#.#...#.....#.#...#.....#.....#.#.#...#.#...#...#...#.#.#.#.#.#.#.#.#.......#.........#
|
||||
#.###.###.#.#.#####.#.#.#.#######.#.#.#.###########.#.#.#####.#####.###.#.#.#####.###.#.###.###.#######.#.#.#.#.#.#.#.#.#.###.###.###.#.###.#
|
||||
#.............#.#...#.#.#.#...#.....#.#...........#.#.#...........#...#...#.#...#.......#.#...#.........#.#...#.#.....#.#.#.................#
|
||||
#.#####.#.###.#.#.###.#.#.#.#.#.###.#.###.#####.###.#.#########.#.###.#####.#.#.#######.#.###.###.#####.#.#.###.#######.#.#.###.###.#####.#.#
|
||||
#.#.....#.....#...#...#.#.#.#.#...#.#...#.#...#.#...#.....#.......#.#...#...#.#...#...#.....#.#.......#.#.#...#.....#...#.#.#...#.......#.#.#
|
||||
#.#.#####.#.###.#######.#.#.#####.#.###.#.#.#.#.#.###.#####.#######.###.#.###.###.#.#.#######.#######.###.###.#####.#.###.#.#.#####.###.#.#.#
|
||||
#.............#.#...#.....#.....#.#.....#.#.#.#.#.#...#.....#.............#...#.#...#...#...#.......#...#.#...#...#.#.#.#...#.....#...#.#.#.#
|
||||
###.#.###.###.#.#.#.#.###.#.#.#.#.#######.#.#.#.#.#.#.#.#####.#############.###.#######.#.#.#######.###.#.#.###.###.#.#.#########.#.###.#.###
|
||||
#...#...#...#.....#.#...#.#.#.#...#.....#...#.#.....#.#...#.#.#...#.....#...#.......#.#...#.#.......#.....#...#...#...#.....#...#.#.....#...#
|
||||
#.###.#.#.###.#####.###.#.###.#.#.#.###.#####.###########.#.#.#.###.#####.#.#.###.#.#.#####.#.#######.#######.###.#######.###.#.#.#.#######.#
|
||||
#...#.#...#...#...#.#...#...#.#.#.#.#.#...#.#.#.....#.....#.#.#.#...#.....#.....#.#...#...#.#.#.....#.........#...........#...#...#.....#...#
|
||||
###.#.###.#.#####.#.#.#####.#.###.#.#.###.#.#.#.###.#.#####.#.#.#.###.###.#######.###.#.#.#.#.#.###.#.###.#.#.#.#######.###.#######.###.#.###
|
||||
#...#...#.#.#...#.#.#.#.#...#...#...#.....#...#.#.#...#.#...#...#.#.#.#.#...#.....#.#.#.#.#.#.#.#...#.#...#.#.#.#.......#...#.#.........#...#
|
||||
#.#####.#.#.#.#.#.#.#.#.#.#####.#####.#####.###.#.#####.#.#.#.###.#.#.#.###.#.#####.#.#.#.#.#.#.###.#.#.###.#.#.#########.###.#.#.#.###.###.#
|
||||
#.#.......#.#.#...#.#.#.#.#.....#...#.....#...#.#.........#...#...#.......#.#...#.......#.#...#.......#...#.#.#...........#...#.#.#...#.#...#
|
||||
#.#.#####.#.#.#####.#.#.#.###.#.#.#######.###.#.#.#####.#######.#.#######.#.###.###############.#########.#.#.###.###########.#.#.#.#.#.#.#.#
|
||||
#.#.#.......#...#...#.#.#.#...#...#...#...#...#.#.......#...#.#.#...#.....#.#...#...............#.#...#...#.#...#.#.........#...#.#.#...#...#
|
||||
#.#.#.#######.#.#.###.#.#.#.###.###.#.#.#######.#.#######.#.#.#.#.#.###.###.#.###.#########.#####.#.#.#.#######.#.#.#.#####.#.###.#.#######.#
|
||||
#.#.#...#.....#.......#...#...#.#...#...#.......#.........#...#...#...#.#...#...............#.....#.#...#...#.......#.#...#.#.#...#...#...#.#
|
||||
#.#.###.#################.###.#.#.#######.#.#######.#################.#.#.###.#######.#####.#.###.#.#####.#.#.#########.#.#.###.###.###.#.#.#
|
||||
#.#.#.#.....#.....#.....#.....#.#.....#.#.#.#.#.....#...#.........#...#.#.#...#...#.#.....#.#...#.#.......#.#.....#.....#.#.#...#...#...#...#
|
||||
#.#.#.#####.#.###.#.###.#####.#######.#.#.#.#.#.#####.#.#.#######.#.###.#.#####.#.#.#.###.#.#.#.###########.#####.#.#####.#.#.###.###.#####.#
|
||||
#.....#...#.......#...#.......#.......#...#.#.....#...#...#.......#.#...#.#.....#.#.#...#.#.#.#.......#...#...#.#...#...#.#...#.....#...#...#
|
||||
#.#####.#.#######.#.###.#######.###########.#.#####.#######.#####.#.#####.#.#####.#.#.###.#.#.#######.#.#.#.#.#.#####.#.#.#########.###.#.#.#
|
||||
#...#...#...#.....#.#...#.....#.....#.......#.#.#...#...#...#.....#.......#...#.#.#...#...#.#...#.....#.#...#...#.....#.#.....#.......#.....#
|
||||
#####.#.###.#.#.###.#.#.#.###.#####.#.#######.#.#.#####.#.###.#############.#.#.#.#.###.#.#.###.#.#.#.#.#######.#.#####.#.###.#.###.#.#.#.#.#
|
||||
#...#.#.....#.#.#...#.#.#.#.#.#.....#...........#.#.....#.#.#.#.............#.#.#.#...#.#.#.#...#.#.#.#.......#.#.#.........#.#.#.......#...#
|
||||
#.#.#.#.#####.###.###.#.#.#.#.#.#####.###.###.#.#.#.###.#.#.#.###.#######.###.#.#.#####.#.#.###.#.#.#.#.#.#.#.#.###.#######.#.#.###.#######.#
|
||||
#.#...#.......#...#...#.#...#.#.....#.#.#.....#...#...#...#.#...#.#...#.......#...#.....#.#...#.#.#.....#...#.#.....#.....#.#.#.........#...#
|
||||
#.#####.#.###.#.###.#.#####.#.#####.#.#.#####.###.###.###.#.###.#.#.#.#.#######.###.#########.###.#####.#####.###########.#.#.#####.###.#.#.#
|
||||
#.#...#.....#.#...#.#.#...#.#.....#.#.#.....#.#...#...#...#.#...#.#.#.#.......#.#...#.......#.#...#.#...#...#.#.........#...#.........#.#...#
|
||||
#.#.#.#.#.###.###.#.#.#.#.#.#.###.#.#.#.###.#.#.###.###.###.#.#####.#.#.#.#.#.#.#.#.#.###.#.#.#.###.#.#.###.#.#.#######.#.#########.#.#.#.#.#
|
||||
#.#.#...#.#.....#.#.....#...#...#.#.#...#...#...#...#...#...#.......#...#.#...#.#.#.#.#...#.#.#...#...#.....#.....#.....#...#.......#...#.#.#
|
||||
#.#.###.#.#.#####.#############.#.#.#######.#####.#.#.###.#############.#.#.###.#.#.#.#.#.###.###.#.###.#.#.#######.#######.###.#.#.#######.#
|
||||
#.#.#...#...#.....#.....#.....#.#.#...#...#.......#.#...#...#.........#...#.....#.#.#...#...#.....#.#...#.#.#.......#.....#...#.#.........#.#
|
||||
#.#.#.###.###.#####.###.###.#.#.#####.#.#.#########.###.###.#.#####.#.#####.#####.#.#.#.###.#######.#####.#.#.#.#####.#######.###.#.###.#.#.#
|
||||
#.#.#.#.#.#.#.#.......#.....#.#.....#...#.#.......#...#...#.#...#...#...#...#.....#.#...#.#...#...#.#...#.#.#.#.#...........#...#.#.....#...#
|
||||
#.#.#.#.#.#.#.#.#####.###.#########.#####.#.###.###.#####.#.#.#.#.#######.###.#####.###.#.###.#.#.#.#.#.#.#.#.#.#.#######.#####.#.#.#######.#
|
||||
#.#.........#.#.....#.#...#.......#.#.....#...#.....#.....#.....#.....#...#...#...#...#...#.#...#.#...#.#.#...#.#.....#...#.....#.#...#.#...#
|
||||
#.#.#.###.#.#.###.###.#.###.###.###.#.#####.#########.#.#####.#######.#.###.###.#.#.#####.#.#####.#####.#.###.#.#####.#.###.#####.###.#.#.###
|
||||
#...#.................#.#...#...#...#.....#.#.......#.#.#...#.....#...#.#.....#.#.#.....#.#.......#...#...#...#.#.....#.#...#...#.#.#.#.....#
|
||||
#.#####.#####.#.###.#####.###.###.#.#####.###.#####.#.###.#.#####.#.#.#.#####.#.#######.#.###.#.#.#.#.#.#######.#######.#.###.#.#.#.#.#######
|
||||
#...#.#.#...#.#...#.........#.....#.....#...#...#...#.....#...#.....#.#...#...#.......#.#.#...#.#...#...#.......#.......#.#...#.#...#.#.....#
|
||||
###.#.#.#.#.#.###.###########.#.#####.#####.###.#.###########.#.#.#######.#.###.#.###.#.#.#.#.#########.#.#######.#####.#.###.#.#####.#.###.#
|
||||
#...#.#...#.#...#.#.........#.#.#...#.#.....#...#.......#...#.#...#...#.........#...#.#...#.#.#...#...#.#.#...#.....#...#.....#...#...#...#.#
|
||||
#.###.#####.###.###.###.#.#.#.#.#.#.#.#.#####.#########.#.#.#.#.###.#.#.#######.###.#######.###.#.#.#.#.#.#.#.#.###.#############.#.###.###.#
|
||||
#.#...#.....#...#...#...#.#...#.#.#...#.......#.....#...#.#...#...#.#...#.....#...#.#.....#.....#.#.#...#.#.#.#.#...#.....#.....#.#.....#...#
|
||||
#.###.#.###.#.###.#####.#.###.#.###############.###.#.###.#####.#.#.#######.#####.#.#.#.#.#######.#.###.#.#.###.#.###.###.#.###.#.#####.#.###
|
||||
#.....#.#...#...#.#...#.#...#.#.#...........#.....#.#.#...#.....#...#.......#...#.....#.#.....#...#...#.#.#.#...#.....#.#.#.#.#.#.....#.#...#
|
||||
#.#.#.#.###.###.#.#.#.#.###.###.#.###.###.#.#######.#.###.#.###.#####.###.###.#.#.#####.#####.#.#.###.#.#.#.#.#########.#.#.#.#.#####.###.#.#
|
||||
#...#.#...#.....#.#.#.#.....#...#.......#.#.........#...#.#...#...#.....#.....#.....#...#.#.....#.#...#...#.#.....#.....#...#.#.....#...#.#.#
|
||||
#####.###.#.#.###.#.#.#######.#########.#.#######.#####.#.###.#.#.#######.#######.#.#.###.#.#.#.#.#.#######.#####.#.###.#####.#.###.###.###.#
|
||||
#.#.....#.#.#...#.#.#.........#.......#.#.#.....#.#...#.#...#...#.#.....#.#.......#...#.#.......#.#.#...#.......#...#...#.....#...#...#...#.#
|
||||
#.#.#.###.#.###.#.#.###.#####.#.#.#####.#.#.###.###.#.#.#.#.#####.#.###.###.#####.###.#.#.#########.#.#.#.###.#######.#.#.###.###.#######.#.#
|
||||
#...#.....#...#...#.....#...#.#.#.......#.#...#.#...#.....#.#.....#...#.....#...#.#.......#...#.....#.#.#...#.......#...#.#.#...#...#...#.#.#
|
||||
#.###.###########.###.#.#.#.#.#.#########.###.#.#.#.#######.#.#######.#######.#.#.#########.#.#.#####.#.###.#.###.#.###.#.#.###.###.#.#.#.#.#
|
||||
#.#.#.....#.......#.#.#.#.#.#.#.......#.....#.#...#...#.....#.#.....#.....#...#.#...........#.#...#...#...#.#...#.#.#...#.#.#...#.#...#.#...#
|
||||
#.#.#####.#.#####.#.#.###.#.#######.#.#.#####.#####.#.###.###.#.###.###.#.#.###.#############.###.#######.#.#.#.#.#.#.###.#.#.###.#####.###.#
|
||||
#...#...#.#...#.....#.....#.......#.........#.#.....#.#...#.#.#...#...#.#.....#.......#.....#...#...........#.#...#.#.#...#.#.#.......#.....#
|
||||
###.#.#.#.###.#.###.#############.#.#######.#.#####.#.#.###.#.###.###.#.#########.###.#.#.#####.#.#####.#.###.#####.#.#.###.#.#.###.#########
|
||||
#...#.#.#.#...#.#...#...........#.#.....#.......#...#...#...#...#.#.#.#...#.#.........#.#.......#...#...#.#.#.....#...#...#...#.#...#.....#.#
|
||||
#####.#.#.#.###.#.###.###.#####.#.#####.#.#####.#.#.#####.#####.#.#.#.###.#.#.###########.###########.###.#.#####.#.#####.###.###.###.#.#.#.#
|
||||
#...#.....#.#...#.....#...#...#.#.....#.#.#.....#.#.....#.....#...#...#.#.#.#...........#.................#...#...#.....#...#...#.....#.#.#.#
|
||||
#.#.#.###.#.#.#.#######.###.#.#######.#.#.#.#####.#.#.#.#.###.#####.###.#.#.#########.#.#######.#.#####.#.###.#.#.#####.#.#.###.#######.#.#.#
|
||||
#.#...#.....#.#.....#...#...#.........#.#...#.....#...#...#...........................#...#...#.#.#...#.....#.#.....#...#.#...#.....#...#.#.#
|
||||
#.###.#.#.###.#.###.#.###.#.#########.#.#.###.#####.#####.#.#.#.###.#.#.###.#.#######.###.#.###.#.#.#.###.#.#.#.###.#.#.#.###.#####.#.###.#.#
|
||||
#...#.#.....#.#...#.#.#...#.#...#...#.#...#.......#...#.#...#.#.#...#.#...#.#.....#...#...#.....#...#...#.....#.#...#.#.....#.....#.#.#.....#
|
||||
#.#.#.###.#.#.#.#.#.###.###.#.#.#.#.#.###.#######.#.#.#.#.#.#.#.#.#######.#.#####.#.#.#.###.#####.#####.#.#####.#.#.#.#.#######.#.#.#.#.###.#
|
||||
#.#.#.....#.#...#.#.....#.#.#.#...#.#...#...#.....#...#...#...#.#.......#.......#.#.#...#...#.........#.....#...#.#...#.#.....#.#.#.#.....#.#
|
||||
#.#.#####.#.#.#.#.#######.#.#.#####.#####.#.#.#####.###.#.#.###.#######.#.#.#####.#.#.###.###########.#####.#.#.###.#.#.#.###.###.#.###.#.#.#
|
||||
#.#.#...#.#.#.#.#...#.......#.....#.......#.#.#.....#...#.#.......#...#...#.#...........................#...#.#.....#...#...#.#...#.......#.#
|
||||
###.#.#.#.#.#.#.###.###########.#.#####.#.#.#.#.#.#.###.#.#.#####.#.#.###.###.#####.###.#.#.###.#.#.###.#.###.#.###.#.#####.#.#.#######.###.#
|
||||
#...#.#.....#.#...#.#...........#.#...#.....#.#.#.#...#.........................#.#.#...#...#...#.#.....#.#.....#...........#.#...#.#...#...#
|
||||
#.#.#.###.#####.#.#.#.#######.###.#.#########.#.###.#.###.#.#####.#.#.###.#.#.#.#.#.#.#######.#########.#.###.###.#.#.#######.###.#.#.#.#.###
|
||||
#.#.#.#...#.....#.#.#.#.....#.#...#...........#...#.........................#.#.#...#.#.#...#.#.............#...#.......#...#.....#...#.....#
|
||||
#.###.#.#.#.#####.#.#.#####.#.#.###########.###.#.#.###.#.#.###.###.#.#.#.#.###.#.###.#.#.#.#.#.#.#.#.#####.###.###.#.#.#.#.#######.###.#.#.#
|
||||
#S......#...#.....#.........#...............#...#.....#.......#.....#...#.......#.....#...#.....#...#.......#...........#.#.................#
|
||||
#############################################################################################################################################
|
15
2024/day16/input.txt.h
Normal file
15
2024/day16/input.txt.h
Normal file
@ -0,0 +1,15 @@
|
||||
#pragma once
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
extern uint32_t _binary_2024_day16_input_txt_start __asm("_binary_2024_day16_input_txt_start");
|
||||
extern uint32_t _binary_2024_day16_input_txt_end __asm("_binary_2024_day16_input_txt_end");
|
||||
extern uint32_t _binary_2024_day16_input_txt_size __asm("_binary_2024_day16_input_txt_size");
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
15
2024/day16/sample1.txt
Normal file
15
2024/day16/sample1.txt
Normal file
@ -0,0 +1,15 @@
|
||||
###############
|
||||
#.......#....E#
|
||||
#.#.###.#.###.#
|
||||
#.....#.#...#.#
|
||||
#.###.#####.#.#
|
||||
#.#.#.......#.#
|
||||
#.#.#####.###.#
|
||||
#...........#.#
|
||||
###.#.#####.#.#
|
||||
#...#.....#.#.#
|
||||
#.#.#.###.#.#.#
|
||||
#.....#...#.#.#
|
||||
#.###.#.#.#.#.#
|
||||
#S..#.....#...#
|
||||
###############
|
15
2024/day16/sample1.txt.h
Normal file
15
2024/day16/sample1.txt.h
Normal file
@ -0,0 +1,15 @@
|
||||
#pragma once
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
extern uint32_t _binary_2024_day16_sample1_txt_start __asm("_binary_2024_day16_sample1_txt_start");
|
||||
extern uint32_t _binary_2024_day16_sample1_txt_end __asm("_binary_2024_day16_sample1_txt_end");
|
||||
extern uint32_t _binary_2024_day16_sample1_txt_size __asm("_binary_2024_day16_sample1_txt_size");
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
11
2024/day16/solution.c
Normal file
11
2024/day16/solution.c
Normal file
@ -0,0 +1,11 @@
|
||||
#include <stdint.h>
|
||||
|
||||
int64_t _2024_day16_part1(const char * input, int length)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
int64_t _2024_day16_part2(const char * input, int length)
|
||||
{
|
||||
return -1;
|
||||
}
|
32
dijkstra.c
Normal file
32
dijkstra.c
Normal file
@ -0,0 +1,32 @@
|
||||
#include "cartesian.h"
|
||||
#include "dijkstra.h"
|
||||
#include "heap.h"
|
||||
#include "memory.h"
|
||||
|
||||
void dijkstra_cartesian(char * graph,
|
||||
int stride,
|
||||
int width, int height,
|
||||
int source_x, int source_y,
|
||||
int dest_x, int dest_y,
|
||||
char wall)
|
||||
{
|
||||
struct heap_entry queue[width * height / 2 + 1];
|
||||
int queue_length = 0;
|
||||
|
||||
// distance from source
|
||||
int dist[width * height];
|
||||
// initialize all distances to the maximum distance
|
||||
memory_set_int(dist, 0x7fffffff, width * height);
|
||||
// initialize the distance from the source to the source to zero
|
||||
dist[source_y * width + source_x] = 0;
|
||||
|
||||
|
||||
int prev[width * height];
|
||||
// initialize the all node paths to "unknown"
|
||||
memory_set_int(prev, -1, width * height);
|
||||
|
||||
// initialize the queue with "source"
|
||||
heap_append_xy(queue, &queue_length, 0, source_x, source_y);
|
||||
|
||||
//while queue_length > 0:
|
||||
}
|
0
dijkstra.h
Normal file
0
dijkstra.h
Normal file
47
heap.c
47
heap.c
@ -1,4 +1,5 @@
|
||||
#include "heap.h"
|
||||
#include "memory.h"
|
||||
|
||||
void heap_sift_up(struct heap_entry * e, int ix)
|
||||
{
|
||||
@ -16,6 +17,31 @@ void heap_sift_up(struct heap_entry * e, int ix)
|
||||
}
|
||||
}
|
||||
|
||||
void heap_sift_down(struct heap_entry * e, int heap_length, int ix)
|
||||
{
|
||||
while (true) {
|
||||
int child_l = 2 * ix + 1;
|
||||
int child_r = 2 * ix + 2;
|
||||
if (child_l >= heap_length)
|
||||
break;
|
||||
|
||||
int child = child_l;
|
||||
if (child_r < heap_length && e[child_l].key < e[child_r].key) {
|
||||
child = child_r;
|
||||
}
|
||||
|
||||
if (e[ix].key < e[child].key) {
|
||||
// swap child and ix
|
||||
struct heap_entry tmp = e[child];
|
||||
e[child] = e[ix];
|
||||
e[ix] = tmp;
|
||||
ix = child;
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void heap_append(struct heap_entry * e, int * heap_length, int key, int value)
|
||||
{
|
||||
int ix = *heap_length;
|
||||
@ -25,6 +51,16 @@ void heap_append(struct heap_entry * e, int * heap_length, int key, int value)
|
||||
(*heap_length) += 1;
|
||||
}
|
||||
|
||||
void heap_append_xy(struct heap_entry * e, int * heap_length, int key, int x, int y)
|
||||
{
|
||||
int ix = *heap_length;
|
||||
e[ix].key = key;
|
||||
e[ix].x = x;
|
||||
e[ix].y = y;
|
||||
heap_sift_up(e, ix);
|
||||
(*heap_length) += 1;
|
||||
}
|
||||
|
||||
int heap_find(struct heap_entry * e, int length, int ix, int key)
|
||||
{
|
||||
if (e[ix].key == key)
|
||||
@ -47,3 +83,14 @@ int heap_find(struct heap_entry * e, int length, int ix, int key)
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
struct heap_entry heap_extract_max(struct heap_entry * e, int * heap_length)
|
||||
{
|
||||
struct heap_entry entry = e[0];
|
||||
|
||||
(*heap_length)--;
|
||||
memory_copy_u32(&e[1], *heap_length, &e[0]);
|
||||
heap_sift_down(e, *heap_length, 0);
|
||||
|
||||
return entry;
|
||||
}
|
||||
|
13
heap.h
13
heap.h
@ -1,17 +1,28 @@
|
||||
#pragma once
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
struct heap_entry {
|
||||
int key;
|
||||
int value;
|
||||
union {
|
||||
int value;
|
||||
struct {
|
||||
int16_t x;
|
||||
int16_t y;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
void heap_sift_up(struct heap_entry * e, int ix);
|
||||
void heap_sift_down(struct heap_entry * e, int heap_length, int ix);
|
||||
void heap_append(struct heap_entry * e, int * heap_length, int key, int value);
|
||||
void heap_append_xy(struct heap_entry * e, int * heap_length, int key, int x, int y);
|
||||
int heap_find(struct heap_entry * e, int length, int ix, int key);
|
||||
struct heap_entry heap_extract_max(struct heap_entry * e, int * heap_length);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
@ -41,6 +41,8 @@
|
||||
#include "2024/day14/input.txt.h"
|
||||
#include "2024/day15/sample1.txt.h"
|
||||
#include "2024/day15/input.txt.h"
|
||||
#include "2024/day16/sample1.txt.h"
|
||||
#include "2024/day16/input.txt.h"
|
||||
|
||||
static struct start_size sample[][2] = {
|
||||
{
|
||||
@ -163,6 +165,12 @@ static struct start_size sample[][2] = {
|
||||
{ ( char *)&_binary_2024_day15_sample1_txt_start,
|
||||
(uint32_t)&_binary_2024_day15_sample1_txt_size },
|
||||
},
|
||||
{
|
||||
{ ( char *)&_binary_2024_day16_sample1_txt_start,
|
||||
(uint32_t)&_binary_2024_day16_sample1_txt_size },
|
||||
{ ( char *)&_binary_2024_day16_sample1_txt_start,
|
||||
(uint32_t)&_binary_2024_day16_sample1_txt_size },
|
||||
},
|
||||
};
|
||||
|
||||
static struct start_size input[] = {
|
||||
@ -206,4 +214,6 @@ static struct start_size input[] = {
|
||||
(uint32_t)&_binary_2024_day14_input_txt_size },
|
||||
{ ( char *)&_binary_2024_day15_input_txt_start,
|
||||
(uint32_t)&_binary_2024_day15_input_txt_size },
|
||||
{ ( char *)&_binary_2024_day16_input_txt_start,
|
||||
(uint32_t)&_binary_2024_day16_input_txt_size },
|
||||
};
|
||||
|
@ -1,7 +1,6 @@
|
||||
#include "linear_algebra.h"
|
||||
|
||||
#include "printf.h"
|
||||
//#include <stdio.h>
|
||||
|
||||
double determinant_2x2(double a, double b,
|
||||
double c, double d)
|
||||
@ -14,32 +13,6 @@ double determinant_2x2(double a, double b,
|
||||
return a * d - b * c;
|
||||
}
|
||||
|
||||
/*
|
||||
5550.00 450000000444000.00 600000000222000.00
|
||||
81081081161.08 108108108148.11
|
||||
|
||||
-3876.00 -460000000548084.00 -400000000524792.00
|
||||
118679050709.00 103199174542.00
|
||||
|
||||
-6595.00 -470000000250610.00 -690000000567170.00
|
||||
71266110727.92 104624715779.71
|
||||
|
||||
4278.00 440000001045978.00 460000000280508.00
|
||||
102851800151.00 107526881786.00
|
||||
*/
|
||||
|
||||
union di {
|
||||
double d;
|
||||
int64_t i;
|
||||
};
|
||||
|
||||
static int64_t raw_double(double n)
|
||||
{
|
||||
union di di;
|
||||
di.d = n;
|
||||
return di.i;
|
||||
}
|
||||
|
||||
struct double2 cramers_rule_2x2(double a1, double b1, double c1,
|
||||
double a2, double b2, double c2)
|
||||
{
|
||||
|
11
memory.c
11
memory.c
@ -22,3 +22,14 @@ void memory_copy_char(char * src, int length, char * dst)
|
||||
dst[i] = src[i];
|
||||
}
|
||||
}
|
||||
|
||||
void memory_copy_u32(void * _src, int length, void * _dst)
|
||||
{
|
||||
// size given in bytes
|
||||
uint32_t * src = _src;
|
||||
uint32_t * dst = _dst;
|
||||
|
||||
for (int i = 0; i < length; i++) {
|
||||
dst[i] = src[i];
|
||||
}
|
||||
}
|
||||
|
1
memory.h
1
memory.h
@ -7,6 +7,7 @@ extern "C" {
|
||||
void memory_set_char(char * buf, char c, int length);
|
||||
void memory_set_int(int * buf, int c, int length);
|
||||
void memory_copy_char(char * src, int length, char * dst);
|
||||
void memory_copy_u32(void * _src, int length, void * _dst);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
@ -44,6 +44,8 @@ void _2024_day14_render(const struct font * font,
|
||||
const void * maple_ft0_data);
|
||||
int64_t _2024_day15_part1(const char * input, int length);
|
||||
int64_t _2024_day15_part2(const char * input, int length);
|
||||
int64_t _2024_day16_part1(const char * input, int length);
|
||||
int64_t _2024_day16_part2(const char * input, int length);
|
||||
|
||||
struct day_funcs solution[] = {
|
||||
{
|
||||
@ -146,4 +148,9 @@ struct day_funcs solution[] = {
|
||||
{_2024_day15_part1, _2024_day15_part2},
|
||||
NULL,
|
||||
},
|
||||
{
|
||||
2024, 16,
|
||||
{_2024_day16_part1, _2024_day16_part2},
|
||||
NULL,
|
||||
},
|
||||
};
|
||||
|
@ -63,4 +63,7 @@ DAY_OBJ = \
|
||||
2024/day14/solution.o \
|
||||
2024/day15/sample1.txt.o \
|
||||
2024/day15/input.txt.o \
|
||||
2024/day15/solution.o
|
||||
2024/day15/solution.o \
|
||||
2024/day16/sample1.txt.o \
|
||||
2024/day16/input.txt.o \
|
||||
2024/day16/solution.o
|
||||
|
19
test/run.sh
Normal file
19
test/run.sh
Normal file
@ -0,0 +1,19 @@
|
||||
#!bin/bash
|
||||
|
||||
set -eux
|
||||
|
||||
for i in test/test_*.c; do
|
||||
name=${i%.c}
|
||||
gcc -Og -g -gdwarf-5 \
|
||||
-std=c2x \
|
||||
-Wall -Werror -Wfatal-errors \
|
||||
-Wno-error=unused-variable \
|
||||
-I. \
|
||||
-o ${name} \
|
||||
${name}.c \
|
||||
memory.c \
|
||||
dijkstra.c \
|
||||
heap.c
|
||||
|
||||
./${name}
|
||||
done
|
27
test/runner.h
Normal file
27
test/runner.h
Normal file
@ -0,0 +1,27 @@
|
||||
#pragma once
|
||||
|
||||
typedef bool (*test_t)(const char ** scenario);
|
||||
|
||||
#define ANSI_RED "\x1b[31m"
|
||||
#define ANSI_GREEN "\x1b[32m"
|
||||
#define ANSI_RESET "\x1b[0m"
|
||||
|
||||
#define RUNNER(tests) \
|
||||
int main() \
|
||||
{ \
|
||||
int fail_count = 0; \
|
||||
for (int i = 0; i < (sizeof (tests)) / (sizeof (test_t)); i++) { \
|
||||
const char * scenario = NULL; \
|
||||
bool result = tests[i](&scenario); \
|
||||
const char * result_s = result ? "ok" : ANSI_RED "fail" ANSI_RESET; \
|
||||
fail_count += !result; \
|
||||
fprintf(stderr, "%s: %s\n", scenario, result_s); \
|
||||
} \
|
||||
if (fail_count == 0) { \
|
||||
fprintf(stderr, ANSI_GREEN "failed tests: %d\n\n" ANSI_RESET, fail_count); \
|
||||
} else { \
|
||||
fprintf(stderr, ANSI_RED "failed tests: %d\n\n" ANSI_RESET, fail_count); \
|
||||
} \
|
||||
\
|
||||
return !(fail_count == 0); \
|
||||
}
|
21
test/test_heap.c
Normal file
21
test/test_heap.c
Normal file
@ -0,0 +1,21 @@
|
||||
#include <stdio.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#include "runner.h"
|
||||
|
||||
#include "heap.h"
|
||||
|
||||
static bool heap_test_0(const char ** scenario)
|
||||
{
|
||||
*scenario = "heap_extract_max";
|
||||
|
||||
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
test_t heap_tests[] = {
|
||||
heap_test_0,
|
||||
};
|
||||
|
||||
RUNNER(heap_tests)
|
BIN
test/test_memory
Executable file
BIN
test/test_memory
Executable file
Binary file not shown.
23
test/test_memory.c
Normal file
23
test/test_memory.c
Normal file
@ -0,0 +1,23 @@
|
||||
#include <stdio.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#include "runner.h"
|
||||
|
||||
#include "memory.h"
|
||||
|
||||
static bool memory_test_0(const char ** scenario)
|
||||
{
|
||||
*scenario = "memory_copy_u32 ordering";
|
||||
|
||||
uint32_t l[] = {1, 2, 3, 4};
|
||||
|
||||
memory_copy_u32(&l[1], 3, &l[0]);
|
||||
|
||||
return l[0] == 2 && l[1] == 3 && l[2] == 4;
|
||||
}
|
||||
|
||||
test_t memory_tests[] = {
|
||||
memory_test_0,
|
||||
};
|
||||
|
||||
RUNNER(memory_tests)
|
Loading…
x
Reference in New Issue
Block a user