diff --git a/day20/d20p1.swift b/day20/d20p1.swift new file mode 100644 index 0000000..a632637 --- /dev/null +++ b/day20/d20p1.swift @@ -0,0 +1,89 @@ +import Foundation + +struct Coord : Hashable, CustomStringConvertible { + let (x, y): (Int, Int) + var description: String { return "(\(x), \(y))" } +} + +struct Maze : CustomStringConvertible { + let (w, h): (Int, Int) + let walls: Set + let (start, end): (Coord, Coord) + var description: String { + var s = Array(repeating: Array(repeating: " ", count: w), count: (h+1)/2) + walls.forEach { wall in + if wall.y.isMultiple(of: 2) { + s[wall.y/2][wall.x] = (s[wall.y/2][wall.x] == " ") ? "▀" : "█" + } else { + s[wall.y/2][wall.x] = (s[wall.y/2][wall.x] == " ") ? "▄" : "█" + } + } + return s.map { $0.joined() + "\n" }.joined() + "\(start), \(end)" + } + let adjacents = [(-1, 0), (1, 0), (0, -1), (0, 1)] + + func valid(_ cell: Coord) -> Bool { + return cell.x >= 0 && cell.x < w && cell.y >= 0 && cell.y < h && + !walls.contains(cell) + } + + func neighbor(of cell: Coord, isNot excluded: Coord) -> Coord { + return adjacents + .map { dx, dy in Coord(x: cell.x + dx, y: cell.y + dy) } + .filter { newCell in valid(newCell) && newCell != excluded }[0] + } + + func cheats(of cell: Coord) -> [Coord] { + return adjacents + .map { dx, dy in Coord(x: cell.x + dx*2, y: cell.y + dy*2) } + .filter(valid) + } + + func cheats() -> [Int] { + var cost: [Coord: Int] = [start: 0] + var jumps: [(Coord, Coord)] = [] + var cell = start + var prevCell = start + var currentCost = 0 + while cell != end { + // list potential cheats from current cell + let newCheats = cheats(of: cell).filter { !cost.keys.contains($0) } + jumps.append(contentsOf: newCheats.map { dest in (cell, dest)} ) + // add cost to table + let nextCell = neighbor(of: cell, isNot: prevCell) + currentCost += 1 + cost[nextCell] = currentCost + prevCell = cell + cell = nextCell + } + return jumps.map { from, to in cost[to]! - cost[from]! - 2 } + } +} + +func readInput(_ filePath: String) throws -> Maze { + let content = try String(contentsOfFile: filePath, encoding: .ascii) + let lines = content.split(separator: "\n") + let (w, h) = (lines[0].count, lines.count) + var walls: Set = [] + var (start, end) = (Coord(x: 0, y: 0), Coord(x: w-1, y: h-1)) + lines.enumerated().forEach { i, line in + line.enumerated().forEach { j, cell in + let coord = Coord(x: j, y: i) + if cell == "#" { + walls.insert(coord) + } else if cell == "S" { + start = coord + } else if cell == "E" { + end = coord + } + } + } + return Maze(w: w, h: h, walls: walls, start: start, end: end) +} + +let maze = try readInput(CommandLine.arguments[1]) +print(maze) +let cheats = maze.cheats() +print(cheats.reduce(into: [:]) { counts, t in counts[t, default: 0] += 1 }) +print(cheats.filter { $0 >= 100 }.count) + diff --git a/day20/input.txt b/day20/input.txt new file mode 100644 index 0000000..595dd55 --- /dev/null +++ b/day20/input.txt @@ -0,0 +1,141 @@ +############################################################################################################################################# +#...#.......................#...###...#...#...#...#...###.....#...#.............#...#####.....#...............###.......#...#.....#.........# +#.#.#.#####################.#.#.###.#.#.#.#.#.#.#.#.#.###.###.#.#.#.###########.#.#.#####.###.#.#############.###.#####.#.#.#.###.#.#######.# +#.#.#.......#.............#.#.#.#...#.#.#...#...#.#.#.#...#...#.#.#.......#...#.#.#...#...#...#.....#...#...#...#.....#...#.#.#...#.#.......# +#.#.#######.#.###########.#.#.#.#.###.#.#########.#.#.#.###.###.#.#######.#.#.#.#.###.#.###.#######.#.#.#.#.###.#####.#####.#.#.###.#.####### +#.#.###...#...#...........#.#.#.#.#...#.#.....#...#.#...#...#...#.###...#...#.#...#...#.#...###...#.#.#...#.....#...#.....#.#.#.#...#.###...# +#.#.###.#.#####.###########.#.#.#.#.###.#.###.#.###.#####.###.###.###.#.#####.#####.###.#.#####.#.#.#.###########.#.#####.#.#.#.#.###.###.#.# +#.#.#...#.....#.#.........#...#...#.#...#...#...#...#.....###.#...#...#.#...#.#.....###.#...#...#.#.#.###.....###.#.....#.#.#.#.#...#.#...#.# +#.#.#.#######.#.#.#######.#########.#.#####.#####.###.#######.#.###.###.#.#.#.#.#######.###.#.###.#.#.###.###.###.#####.#.#.#.#.###.#.#.###.# +#.#.#.......#...#.#.......#...#...#...#.....#...#...#...#...#.#...#...#...#...#.#.....#.#...#.#...#.#.#...#...#...#.....#.#.#.#.###.#...#...# +#.#.#######.#####.#.#######.#.#.#.#####.#####.#.###.###.#.#.#.###.###.#########.#.###.#.#.###.#.###.#.#.###.###.###.#####.#.#.#.###.#####.### +#.#.......#...#...#.....#...#...#.#.....#...#.#.#...#...#.#.#.#...###.....#...#.#.#...#.#.###.#...#.#.#...#.###...#.....#.#.#.#.#...#...#...# +#.#######.###.#.#######.#.#######.#.#####.#.#.#.#.###.###.#.#.#.#########.#.#.#.#.#.###.#.###.###.#.#.###.#.#####.#####.#.#.#.#.#.###.#.###.# +#.......#...#...#.......#.#.......#.......#...#...#...###.#.#.#.###...###.#.#...#.#...#.#.#...#...#.#.###.#.#...#.#.....#.#.#.#.#.#...#.....# +#######.###.#####.#######.#.#######################.#####.#.#.#.###.#.###.#.#####.###.#.#.#.###.###.#.###.#.#.#.#.#.#####.#.#.#.#.#.######### +###...#.#...###...#.....#.#.........#...............#...#.#.#.#...#.#.#...#.....#...#...#.#...#.###.#.#...#.#.#...#.....#.#.#.#.#.#...#.....# +###.#.#.#.#####.###.###.#.#########.#.###############.#.#.#.#.###.#.#.#.#######.###.#####.###.#.###.#.#.###.#.#########.#.#.#.#.#.###.#.###.# +#...#...#.#...#...#.#...#.#.........#...###...###...#.#.#.#.#.#...#.#.#...#.....#...#.....#...#...#.#.#...#.#.#.........#.#.#.#...#...#.#...# +#.#######.#.#.###.#.#.###.#.###########.###.#.###.#.#.#.#.#.#.#.###.#.###.#.#####.###.#####.#####.#.#.###.#.#.#.#########.#.#.#####.###.#.### +#...#.....#.#...#...#.....#...........#...#.#...#.#.#.#.#.#...#.#...#...#.#.#...#...#.#...#...#...#.#...#.#.#.#.###...###.#.#.#.....#...#...# +###.#.#####.###.#####################.###.#.###.#.#.#.#.#.#####.#.#####.#.#.#.#.###.#.#.#.###.#.###.###.#.#.#.#.###.#.###.#.#.#.#####.#####.# +#...#.#...#...#.#...#.....#...#.....#.#...#.#...#.#.#.#.#...#...#.....#...#...#.#...#.#.#...#.#.#...#...#.#...#.....#...#.#.#.#...###.#.....# +#.###.#.#.###.#.#.#.#.###.#.#.#.###.#.#.###.#.###.#.#.#.###.#.#######.#########.#.###.#.###.#.#.#.###.###.#############.#.#.#.###.###.#.##### +#...#...#.....#...#.#...#.#.#.#...#.#.#.....#...#.#.#.#...#.#.#.....#.......#...#.#...#...#.#.#.#...#.###.....#.........#.#...#...#...#.#...# +###.###############.###.#.#.#.###.#.#.#########.#.#.#.###.#.#.#.###.#######.#.###.#.#####.#.#.#.###.#.#######.#.#########.#####.###.###.#.#.# +#...#.............#.###.#...#...#.#.#.#.....#...#.#.#.#...#.#.#...#.###...#.#...#.#.#...#.#...#...#.#...#.....#...#...###.#.....###...#.#.#.# +#.###.###########.#.###.#######.#.#.#.#.###.#.###.#.#.#.###.#.###.#.###.#.#.###.#.#.#.#.#.#######.#.###.#.#######.#.#.###.#.#########.#.#.#.# +#...#...#.........#.....#.....#...#.#.#...#...#...#.#.#...#.#.#...#.#...#.#.#...#.#...#.#.#.......#...#...#...#...#.#...#.#...#...#...#...#.# +###.###.#.###############.###.#####.#.###.#####.###.#.###.#.#.#.###.#.###.#.#.###.#####.#.#.#########.#####.#.#.###.###.#.###.#.#.#.#######.# +###.....#.....#.........#.#...#...#...#...#...#...#.#.#...#.#...#...#.#...#.#...#.#.....#.#...###.....#.....#...###.#...#.#...#.#.#.#.......# +#############.#.#######.#.#.###.#.#####.###.#.###.#.#.#.###.#####.###.#.###.###.#.#.#####.###.###.#####.###########.#.###.#.###.#.#.#.####### +#.............#.#.....#.#.#.....#.....#.#...#.#...#.#.#...#.....#.#...#.....#...#.#...###...#...#.....#...#...#...#.#.....#.....#...#...#...# +#.#############.#.###.#.#.###########.#.#.###.#.###.#.###.#####.#.#.#########.###.###.#####.###.#####.###.#.#.#.#.#.###################.#.#.# +#...............#...#.#.#.###...#...#.#.#...#.#...#.#...#.#...#.#.#.........#.###.#...#...#.#...#...#...#...#...#.#.#.................#...#.# +###################.#.#.#.###.#.#.#.#.#.###.#.###.#.###.#.#.#.#.#.#########.#.###.#.###.#.#.#.###.#.###.#########.#.#.###############.#####.# +#...................#...#.#...#...#...#...#.#...#.#...#.#...#.#.#.....#...#.#...#.#.#...#.#.#.#...#.#...#.........#.#.#.............#.#...#.# +#.#######################.#.#############.#.###.#.###.#.#####.#.#####.#.#.#.###.#.#.#.###.#.#.#.###.#.###.#########.#.#.###########.#.#.#.#.# +#.........................#.............#.#.#...#.#...#...#...#.....#.#.#.#.###.#.#.#...#.#.#.#.###.#.#...#...#.....#...#...#...#...#...#.#.# +#######################################.#.#.#.###.#.#####.#.#######.#.#.#.#.###.#.#.###.#.#.#.#.###.#.#.###.#.#.#########.#.#.#.#.#######.#.# +#...........#...#.....#.................#.#.#...#.#...#...#.#...#...#.#.#.#...#.#.#...#.#...#.#...#.#.#...#.#.#.#.........#...#...#.....#.#.# +#.#########.#.#.#.###.#.#################.#.###.#.###.#.###.#.#.#.###.#.#.###.#.#.###.#.#####.###.#.#.###.#.#.#.#.#################.###.#.#.# +#.#.....#...#.#.#.#...#.............#...#...###.#.###.#.###...#.#...#.#.#.#...#.#.#...#.###...#...#...###...#...#.....#.....#.......#...#.#.# +#.#.###.#.###.#.#.#.###############.#.#.#######.#.###.#.#######.###.#.#.#.#.###.#.#.###.###.###.#####################.#.###.#.#######.###.#.# +#...#...#.....#...#...............#...#...#...#.#...#...#.......#...#...#.#...#.#.#...#...#...#.#...#...#...#...#.....#.#...#.#.......###...# +#####.###########################.#######.#.#.#.###.#####.#######.#######.###.#.#.###.###.###.#.#.#.#.#.#.#.#.#.#.#####.#.###.#.############# +###...#...........#.....#.......#.........#.#.#.#...#.....#...#...#.......#...#...#...#...#...#.#.#...#...#...#...#...#.#.#...#...#...###...# +###.###.#########.#.###.#.#####.###########.#.#.#.###.#####.#.#.###.#######.#######.###.###.###.#.#################.#.#.#.#.#####.#.#.###.#.# +#...#...#.........#.#...#.#.....#...###...#.#.#...###.#...#.#.#...#...#...#.......#.....###.....#...............###.#...#.#.#.....#.#.....#.# +#.###.###.#########.#.###.#.#####.#.###.#.#.#.#######.#.#.#.#.###.###.#.#.#######.#############################.###.#####.#.#.#####.#######.# +#.#...###.........#.#.....#.......#.....#...#.......#...#.#.#.#...###...#.#.......#############################.....#S..#...#.......#...#...# +#.#.#############.#.###############################.#####.#.#.#.#########.#.###########################################.#############.#.#.### +#.#.#.............#.###...#...#...#...#...#.........#.....#.#.#.#...#.....#.###########################################.#.....#.......#...### +#.#.#.#############.###.#.#.#.#.#.#.#.#.#.#.#########.#####.#.#.#.#.#.#####.###########################################.#.###.#.############# +#...#...#.....#...#.#...#...#...#...#.#.#...#...###...#...#.#...#.#.#.....#.###########################################.#...#.#.........#...# +#######.#.###.#.#.#.#.###############.#.#####.#.###.###.#.#.#####.#.#####.#.###########################################.###.#.#########.#.#.# +###...#...###.#.#...#...#...#.......#.#.......#...#...#.#.#...###.#.....#.#.###########################################.....#...........#.#.# +###.#.#######.#.#######.#.#.#.#####.#.###########.###.#.#.###.###.#####.#.#.#############################################################.#.# +#...#.#.....#...#.......#.#.#.#.....#.......#...#.#...#.#...#.....#...#.#...#...#########...#...#####...#...#############################E#.# +#.###.#.###.#####.#######.#.#.#.###########.#.#.#.#.###.###.#######.#.#.#####.#.#########.#.#.#.#####.#.#.#.###############################.# +#...#.#...#...###.......#.#...#...........#...#...#...#.#...#.......#...#.....#.....#####.#...#.#...#.#.#.#.#...#...#...............#...#...# +###.#.###.###.#########.#.###############.###########.#.#.###.###########.#########.#####.#####.#.#.#.#.#.#.#.#.#.#.#.#############.#.#.#.### +###.#.....#...#.........#.#.......#.......#.....#...#.#.#...#.....#.......#...#...#...#...#...#...#...#...#...#...#...#.......#...#...#.#.### +###.#######.###.#########.#.#####.#.#######.###.#.#.#.#.###.#####.#.#######.#.#.#.###.#.###.#.#########################.#####.#.#.#####.#.### +#...#.....#.###...........#.....#.#.......#.#...#.#.#...###.......#.........#...#.#...#.....#.....#.....................#...#...#.....#.#...# +#.###.###.#.###################.#.#######.#.#.###.#.#############################.#.#############.#.#####################.#.#########.#.###.# +#.#...#...#...#...#...#.......#.#.....#...#.#.#...#.#.....#...###.......#.......#.#.#...###...#...#.#.................#...#...........#.....# +#.#.###.#####.#.#.#.#.#.#####.#.#####.#.###.#.#.###.#.###.#.#.###.#####.#.#####.#.#.#.#.###.#.#.###.#.###############.#.##################### +#...###.#...#...#...#.#.....#.#.....#...###.#.#...#.#.#...#.#...#.....#.#...#...#.#.#.#.#...#.#.....#.............#...#.#.......#...###...### +#######.#.#.#########.#####.#.#####.#######.#.###.#.#.#.###.###.#####.#.###.#.###.#.#.#.#.###.###################.#.###.#.#####.#.#.###.#.### +#.......#.#...#.....#.###...#...###.........#.....#...#.....#...#.....#.....#...#.#.#.#.#...#.###...#.......#.....#.....#.#...#.#.#.....#...# +#.#######.###.#.###.#.###.#####.#############################.###.#############.#.#.#.#.###.#.###.#.#.#####.#.###########.#.#.#.#.#########.# +#.#...#...###.#.#...#.#...#...#...........#.....#.......#...#.###.............#...#...#.....#.....#...#...#...#...#.....#...#.#...#...#.....# +#.#.#.#.#####.#.#.###.#.###.#.###########.#.###.#.#####.#.#.#.###############.#########################.#.#####.#.#.###.#####.#####.#.#.##### +#.#.#...#.....#.#...#...#...#...#...#...#...###...#.....#.#...#...............#...#...#.....#...........#...###.#.#.#...#...#.#.....#...#...# +#.#.#####.#####.###.#####.#####.#.#.#.#.###########.#####.#####.###############.#.#.#.#.###.#.#############.###.#.#.#.###.#.#.#.#########.#.# +#.#...###.......###.......#...#...#...#.........###.....#.#...#.#.............#.#...#...#...#.....#.........#...#...#.....#...#...........#.# +#.###.#####################.#.#################.#######.#.#.#.#.#.###########.#.#########.#######.#.#########.#############################.# +#.....#...#.................#...................#...###...#.#.#...#...#.......#...#.......#...#...#...........#...#.......#.....#...........# +#######.#.#.#####################################.#.#######.#.#####.#.#.#########.#.#######.#.#.###############.#.#.#####.#.###.#.########### +#.......#...#...........#...#...#.................#.#.....#.#...#...#.#...........#.#.....#.#...#.............#.#.#.....#.#...#.#...........# +#.###########.#########.#.#.#.#.#.#################.#.###.#.###.#.###.#############.#.###.#.#####.###########.#.#.#####.#.###.#.###########.# +#.............#.....#...#.#...#...#...#...#...#...#.#.#...#.#...#...#.........#.....#.###...#...#.#.........#...#.#.....#...#.#...#.........# +###############.###.#.###.#########.#.#.#.#.#.#.#.#.#.#.###.#.#####.#########.#.#####.#######.#.#.#.#######.#####.#.#######.#.###.#.######### +#.............#...#.#.....#.........#...#.#.#.#.#.#.#.#...#.#...###.....#...#.#...#...#.....#.#.#...#.......###...#.......#.#...#.#.........# +#.###########.###.#.#######.#############.#.#.#.#.#.#.###.#.###.#######.#.#.#.###.#.###.###.#.#.#####.#########.#########.#.###.#.#########.# +#...........#.....#.###...#.............#...#...#...#.#...#...#.#...###.#.#...###...###...#...#.....#.........#.#.....#...#.....#.#.....#...# +###########.#######.###.#.#############.#############.#.#####.#.#.#.###.#.###############.#########.#########.#.#.###.#.#########.#.###.#.### +#.......###.......#.#...#.#.............###...###...#.#...###.#.#.#.#...#...#...#...#.....#.......#...........#...###.#.......###.#...#.#...# +#.#####.#########.#.#.###.#.###############.#.###.#.#.###.###.#.#.#.#.#####.#.#.#.#.#.#####.#####.###################.#######.###.###.#.###.# +#.#...#.#...###...#.#...#.#.#.............#.#...#.#.#.#...#...#.#.#.#.....#...#.#.#.#.......#.....#...#.............#...#...#...#.#...#.#...# +#.#.#.#.#.#.###.###.###.#.#.#.###########.#.###.#.#.#.#.###.###.#.#.#####.#####.#.#.#########.#####.#.#.###########.###.#.#.###.#.#.###.#.### +#...#.#...#...#...#.###.#.#...#...........#.#...#.#.#.#.#...#...#.#.#...#.....#...#.....#.....#...#.#.#.#...........###...#...#.#.#...#.#...# +#####.#######.###.#.###.#.#####.###########.#.###.#.#.#.#.###.###.#.#.#.#####.#########.#.#####.#.#.#.#.#.###################.#.#.###.#.###.# +#...#.......#.#...#...#.#.#...#.....#...#...#.....#.#.#...#...###.#.#.#.#...#.#.......#.#.......#.#.#.#.#.....#...#...#...###...#...#.#.#...# +#.#.#######.#.#.#####.#.#.#.#.#####.#.#.#.#########.#.#####.#####.#.#.#.#.#.#.#.#####.#.#########.#.#.#.#####.#.#.#.#.#.#.#########.#.#.#.### +#.#.###.....#...#...#...#...#.....#...#.#.....#.....#.#.....###...#.#.#.#.#...#.....#...###.....#...#...#...#...#.#.#.#.#.......#...#.#...### +#.#.###.#########.#.#############.#####.#####.#.#####.#.#######.###.#.#.#.#########.#######.###.#########.#.#####.#.#.#.#######.#.###.####### +#.#.#...#.......#.#.#.....#.....#.......#...#.#.....#.#...#.....#...#.#.#...#.....#.#...#...#...###...#...#.......#.#.#.#.......#...#...#...# +#.#.#.###.#####.#.#.#.###.#.###.#########.#.#.#####.#.###.#.#####.###.#.###.#.###.#.#.#.#.###.#####.#.#.###########.#.#.#.#########.###.#.#.# +#.#...#...#...#...#.#.#...#...#.......###.#.#...#...#.#...#...#...#...#...#.#.###...#.#.#...#.#.....#.#.............#...#.....#...#.#...#.#.# +#.#####.###.#.#####.#.#.#####.#######.###.#.###.#.###.#.#####.#.###.#####.#.#.#######.#.###.#.#.#####.#######################.#.#.#.#.###.#.# +#.#...#.#...#.......#.#.......#...#...#...#...#.#...#.#.....#.#...#.....#.#.#...#...#.#.#...#.#.....#...#.............#.......#.#.#...#...#.# +#.#.#.#.#.###########.#########.#.#.###.#####.#.###.#.#####.#.###.#####.#.#.###.#.#.#.#.#.###.#####.###.#.###########.#.#######.#.#####.###.# +#...#...#.#...#...#...#.........#...###...#...#.#...#.#.....#.#...#...#.#.#.#...#.#.#.#.#.#...#...#.#...#...###...###...#...#...#...###.#...# +#########.#.#.#.#.#.###.#################.#.###.#.###.#.#####.#.###.#.#.#.#.#.###.#.#.#.#.#.###.#.#.#.#####.###.#.#######.#.#.#####.###.#.### +###.......#.#...#.#.###.........#...#...#.#.....#.#...#.#...#.#...#.#.#.#.#.#.#...#.#.#.#.#.#...#.#.#.....#.#...#...#...#.#.#.#.....#...#...# +###.#######.#####.#.###########.#.#.#.#.#.#######.#.###.#.#.#.###.#.#.#.#.#.#.#.###.#.#.#.#.#.###.#.#####.#.#.#####.#.#.#.#.#.#.#####.#####.# +#...#.....#...#...#.#...........#.#.#.#.#.......#.#.#...#.#.#...#...#.#.#.#.#.#...#.#.#.#.#.#.#...#...###.#...#...#...#...#...#.......#.....# +#.###.###.###.#.###.#.###########.#.#.#.#######.#.#.#.###.#.###.#####.#.#.#.#.###.#.#.#.#.#.#.#.#####.###.#####.#.#####################.##### +#...#...#.#...#...#.#.......#...#.#.#.#...#...#.#.#.#.#...#...#...#...#.#.#.#.#...#...#.#.#.#.#.#...#...#.#.....#.#.....#...#...#.......#...# +###.###.#.#.#####.#.#######.#.#.#.#.#.###.#.#.#.#.#.#.#.#####.###.#.###.#.#.#.#.#######.#.#.#.#.#.#.###.#.#.#####.#.###.#.#.#.#.#.#######.#.# +###...#.#.#.#.....#.#.......#.#.#.#.#.#...#.#...#...#.#.#...#...#.#.....#.#.#.#.....#...#.#.#.#.#.#.#...#.#.....#.#.###.#.#.#.#.#.......#.#.# +#####.#.#.#.#.#####.#.#######.#.#.#.#.#.###.#########.#.#.#.###.#.#######.#.#.#####.#.###.#.#.#.#.#.#.###.#####.#.#.###.#.#.#.#.#######.#.#.# +###...#.#...#...#...#.......#.#.#.#...#.#...###.......#...#...#.#.......#.#.#...#...#...#.#...#.#.#...#...#...#.#.#...#...#...#...#.....#.#.# +###.###.#######.#.#########.#.#.#.#####.#.#####.#############.#.#######.#.#.###.#.#####.#.#####.#.#####.###.#.#.#.###.###########.#.#####.#.# +#...#...#.......#.#.........#.#...#...#.#.#...#.....#.......#.#...#...#.#.#.#...#.#.....#.....#...#.....#...#.#.#...#.......#...#.#.....#.#.# +#.###.###.#######.#.#########.#####.#.#.#.#.#.#####.#.#####.#.###.#.#.#.#.#.#.###.#.#########.#####.#####.###.#.###.#######.#.#.#.#####.#.#.# +#...#...#.........#.#...#...#.#.....#...#...#...###.#.#...#.#.###.#.#...#...#.....#.....#...#.....#...#...###.#...#...#.....#.#...#...#...#.# +###.###.###########.#.#.#.#.#.#.###############.###.#.#.#.#.#.###.#.###################.#.#.#####.###.#.#####.###.###.#.#####.#####.#.#####.# +###.#...#...#...#...#.#...#...#.....#...#...#...#...#...#.#...#...#.........#...........#.#.#.....#...#.....#.#...#...#...###.....#.#.......# +###.#.###.#.#.#.#.###.#############.#.#.#.#.#.###.#######.#####.###########.#.###########.#.#.#####.#######.#.#.###.#####.#######.#.######### +#...#.#...#.#.#.#...#.#.............#.#.#.#...#...#...#...#.....#.....#.....#.#.....#...#.#.#.....#...#...#.#...###...#...#...#...#.......### +#.###.#.###.#.#.###.#.#.#############.#.#.#####.###.#.#.###.#####.###.#.#####.#.###.#.#.#.#.#####.###.#.#.#.#########.#.###.#.#.#########.### +#.#...#...#...#.#...#.#.....#.......#.#.#.....#...#.#.#.###.....#.###.#.#...#...#...#.#.#.#.#.....###.#.#.#.....#.....#.....#.#.#...#...#...# +#.#.#####.#####.#.###.#####.#.#####.#.#.#####.###.#.#.#.#######.#.###.#.#.#.#####.###.#.#.#.#.#######.#.#.#####.#.###########.#.#.#.#.#.###.# +#.#.....#.....#.#.#...###...#.....#.#.#.#.....###.#.#.#.#.......#...#.#...#.....#...#.#...#.#.......#.#.#.#...#.#...#.....#...#.#.#...#.#...# +#.#####.#####.#.#.#.#####.#######.#.#.#.#.#######.#.#.#.#.#########.#.#########.###.#.#####.#######.#.#.#.#.#.#.###.#.###.#.###.#.#####.#.### +#.#.....###...#...#.#...#.....#...#.#.#.#.......#...#.#.#.#.....#...#.#...#.....#...#.#.....#...#...#.#.#.#.#.#.###...#...#.###.#.....#.#.### +#.#.#######.#######.#.#.#####.#.###.#.#.#######.#####.#.#.#.###.#.###.#.#.#.#####.###.#.#####.#.#.###.#.#.#.#.#.#######.###.###.#####.#.#.### +#.#...#.....#.....#.#.#.......#...#.#.#...#...#.....#.#.#.#...#.#.#...#.#.#...###.....#...#...#.#.#...#.#...#.#.....###...#...#.#...#.#.#...# +#.###.#.#####.###.#.#.###########.#.#.###.#.#.#####.#.#.#.###.#.#.#.###.#.###.###########.#.###.#.#.###.#####.#####.#####.###.#.#.#.#.#.###.# +#.#...#.#...#.#...#.#.#...#...#...#.#.#...#.#...#...#...#.#...#.#.#.#...#...#.....#.......#...#...#...#.#.....#...#...#...#...#.#.#.#.#...#.# +#.#.###.#.#.#.#.###.#.#.#.#.#.#.###.#.#.###.###.#.#######.#.###.#.#.#.#####.#####.#.#########.#######.#.#.#####.#.###.#.###.###.#.#.#.###.#.# +#.#.#...#.#...#...#.#...#.#.#.#.#...#.#...#...#.#.....###...#...#.#.#...#...#...#.#.....#.....###...#.#.#...#...#.#...#.#...###.#.#.#...#.#.# +#.#.#.###.#######.#.#####.#.#.#.#.###.###.###.#.#####.#######.###.#.###.#.###.#.#.#####.#.#######.#.#.#.###.#.###.#.###.#.#####.#.#.###.#.#.# +#.#.#.#...#.......#.#.....#.#.#.#...#...#...#.#.....#.......#...#.#...#.#.#...#.#.#.....#.........#.#.#.#...#...#.#.#...#.....#.#.#.#...#...# +#.#.#.#.###.#######.#.#####.#.#.###.###.###.#.#####.#######.###.#.###.#.#.#.###.#.#.###############.#.#.#.#####.#.#.#.#######.#.#.#.#.####### +#.#.#.#...#...#...#.#.#...#.#.#...#...#.#...#.....#...#...#.#...#...#.#.#.#...#.#.#...#...#...#...#.#.#.#.#...#.#.#.#.#...#...#.#.#.#.......# +#.#.#.###.###.#.#.#.#.#.#.#.#.###.###.#.#.#######.###.#.#.#.#.#####.#.#.#.###.#.#.###.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.###.#.#.#######.# +#...#.....###...#...#...#...#.....###...#.........###...#...#.......#...#.....#...###...#...#...#...#...#...#...#...#...#...###...#.........# +############################################################################################################################################# diff --git a/day20/test.txt b/day20/test.txt new file mode 100644 index 0000000..c097dae --- /dev/null +++ b/day20/test.txt @@ -0,0 +1,15 @@ +############### +#...#...#.....# +#.#.#.#.#.###.# +#S#...#.#.#...# +#######.#.#.### +#######.#.#...# +#######.#.###.# +###..E#...#...# +###.#######.### +#...###...#...# +#.#####.#.###.# +#.#...#.#.#...# +#.#.#.#.#.#.### +#...#...#...### +###############