From 33485bc92fa986fcbe145a45ed0ecb8fa93b7a67 Mon Sep 17 00:00:00 2001 From: gergo Date: Thu, 22 Dec 2022 23:37:17 +0100 Subject: [PATCH] day 22 (full rewrite for part 2) --- src/main/kotlin/me/gergo/Aoc22.kt | 232 +++++++++++++++--------- src/main/kotlin/me/gergo/coordinates.kt | 7 + src/main/resources/input22-part1.txt | 210 +++++++++++++++++++++ src/main/resources/input22-part2.txt | 210 +++++++++++++++++++++ src/main/resources/input22-test.txt | 21 +++ 5 files changed, 599 insertions(+), 81 deletions(-) create mode 100644 src/main/resources/input22-part1.txt create mode 100644 src/main/resources/input22-part2.txt create mode 100644 src/main/resources/input22-test.txt diff --git a/src/main/kotlin/me/gergo/Aoc22.kt b/src/main/kotlin/me/gergo/Aoc22.kt index 8226463..9ddc502 100644 --- a/src/main/kotlin/me/gergo/Aoc22.kt +++ b/src/main/kotlin/me/gergo/Aoc22.kt @@ -2,27 +2,55 @@ package me.gergo import java.io.File +// Now this was mental. +// I quickly gave up on solving this nicely for Part Two (ie. generally for any kind of input), and rather just added another section to the input, +// that consists of from-to ranges, mapping the edges of the cube with seams, eg. this means: +// 0,100-49,100;50,50-50,99;U;R +// "map the 0,100-49,100 edge to the 50,50-50,99 edge tile by tile, in this order, and whenever we'd exit the first edge Up, change that to Right" +// This way, I ended up with a 50x50x50 cube where Tile22s on the edges are connected by Seam22s, possibly flipping the direction of the traversal. +// From this point, most of the time I spent on debugging the edge declarations and directions, and finding an annoying bug with hitting a wall +// immediately after traversing a seam. + fun main() { - val (board, instructions) = parseMapAndInstructions(File("src/main/resources/input22.txt").readText()) + val (board, instructions) = parseMapAndInstructions(File("src/main/resources/input22-part2.txt").readText()) + + fun resolve(tile: RealTile22, neighbor: Tile22, dir: Direction): Pair = when (neighbor) { + is RealTile22 -> Pair(neighbor, dir) + is Seam22 -> resolve(tile, neighbor.to, neighbor.newDir) + Wall22 -> Pair(tile, dir) + VoidTile22 -> throw IllegalArgumentException("Hit the Void!") + } - var position = board.topLeft() - var facing = Direction.R + var current = board.topLeft() + var currentDir = Direction.R + val debugPath = mutableListOf>() for (ins in instructions) { when (ins) { - Turn22.L -> facing = facing.counterClockWise() - Turn22.R -> facing = facing.clockWise() - is Step22 -> position = board.move(position, ins.amount, facing) + Turn22.L -> currentDir = currentDir.counterClockWise() + Turn22.R -> currentDir = currentDir.clockWise() + is Step22 -> { + for (i in 1..ins.amount) { + val neighbor = when (currentDir) { + Direction.L -> current.left + Direction.U -> current.up + Direction.R -> current.right + Direction.D -> current.down + } + val (next, nextDir) = resolve(current, neighbor, currentDir) + if (next == current) break // Can't move, we hit a wall + current = next + currentDir = nextDir + debugPath.add(Pair(Coordinate(current.x, current.y), currentDir)) + } + } } - - // Debug -// println("Instruction: $ins") -// println(board.print(position, facing)) -// println() } - val row = position.y + 1 - val col = position.x + 1 - val facingValue = when (facing) { + println(board.debug(debugPath)) + + val row = current.y + 1 + val col = current.x + 1 + val facingValue = when (currentDir) { Direction.L -> 2 Direction.U -> 3 Direction.R -> 0 @@ -32,87 +60,72 @@ fun main() { println("Password: $password") } -private class Board22(private val tiles: List) { - - fun topLeft() = Coordinate(row(0).first, 0) - - fun move(at: Coordinate, amount: Int, direction: Direction): Coordinate { - val row = row(at.y) - val col = col(at.x) - val rowWidth = row.last - row.first + 1 - val colWidth = col.last - col.first + 1 - var x = at.x - var y = at.y - for (i in 1..amount) { - when (direction) { - Direction.L -> { - val nx = row.first + Math.floorMod(x - row.first - 1, rowWidth) - if (!isWall(nx, y)) x = nx - } - - Direction.R -> { - val nx = row.first + Math.floorMod(x - row.first + 1, rowWidth) - if (!isWall(nx, y)) x = nx - } +private class Board22(private val tiles: List>) { + fun topLeft() = tiles[0].filterIsInstance().first() - Direction.U -> { - val ny = col.first + Math.floorMod(y - col.first - 1, colWidth) - if (!isWall(x, ny)) y = ny - } - - Direction.D -> { - val ny = col.first + Math.floorMod(y - col.first + 1, colWidth) - if (!isWall(x, ny)) y = ny - } - } - } - return Coordinate(x, y) - } - - private fun isWall(x: Int, y: Int) = tiles[y][x] == '#' - private fun row(y: Int) = tiles[y].indexOfFirst { it != ' ' }..tiles[y].indexOfLast { it != ' ' } - - private fun col(x: Int): IntRange { - var minY = Int.MAX_VALUE - var maxY = 0 + fun debug(path: MutableList>): String { + val debug = Array(tiles.size) { CharArray(tiles[0].size) { ' ' } } for (y in tiles.indices) { - if (tiles[y][x] != ' ') { - minY = minOf(minY, y) - maxY = maxOf(maxY, y) + for (x in tiles[y].indices) { + val t = tiles[y][x] + if (t is RealTile22) debug[y][x] = '.' + else if (t is Wall22) debug[y][x] = '#' } } - return minY..maxY - } - - fun print(position: Coordinate, facing: Direction): String { - val buf = StringBuilder() - for (y in tiles.indices) { - val tile = tiles[y] - if (y == position.y) { - val tileWithAgent = tile.copyOf() - tileWithAgent[position.x] = when (facing) { - Direction.L -> '<' - Direction.U -> '^' - Direction.R -> '>' - Direction.D -> 'v' - } - buf.append(tileWithAgent) - } else { - buf.append(tile) + for ((c, dir) in path) { + debug[c.y][c.x] = when (dir) { + Direction.L -> '<' + Direction.U -> '^' + Direction.R -> '>' + Direction.D -> 'v' } - buf.append('\n') } - return buf.toString() + return debug.joinToString("\n") { it.joinToString("") } } + + operator fun get(x: Int, y: Int) = tiles[y][x] as RealTile22 } +private sealed interface Tile22 +private object VoidTile22 : Tile22 +private class RealTile22(val x: Int, val y: Int, var right: Tile22, var up: Tile22, var left: Tile22, var down: Tile22) : Tile22 +private object Wall22 : Tile22 +private class Seam22(val to: Tile22, val newDir: Direction) : Tile22 + private sealed interface Instruction22 private enum class Turn22 : Instruction22 { L, R } private data class Step22(val amount: Int) : Instruction22 private fun parseMapAndInstructions(text: String): Pair> { - val (boardText, instructionText) = text.split("\n\n") - val tiles = boardText.split('\n').map(String::toCharArray) + val (boardText, instructionText, seamsText) = text.split("\n\n") + + val tiles = boardText.split('\n').mapIndexed { y, line -> + line.mapIndexed { x, t -> + when (t) { + '.' -> RealTile22(x, y, VoidTile22, VoidTile22, VoidTile22, VoidTile22) + '#' -> Wall22 + else -> VoidTile22 + } + } + } + + val debug = Array(tiles.size) { CharArray(tiles[0].size) { ' ' } } + + for (y in tiles.indices) { + for (x in tiles[y].indices) { + val tile = tiles[y][x] + + if (tile is RealTile22) debug[y][x] = '.' + else if (tile is Wall22) debug[y][x] = '#' + + if (tile !is RealTile22) continue + if (x > 0) tile.left = tiles[y][x - 1] + if (y > 0) tile.up = tiles[y - 1][x] + if (x < tiles[y].size - 1) tile.right = tiles[y][x + 1] + if (y < tiles.size - 1) tile.down = tiles[y + 1][x] + } + } + val instructions = Regex("(L|R|\\d+)+?").findAll(instructionText) .map { when (it.value) { @@ -121,5 +134,62 @@ private fun parseMapAndInstructions(text: String): Pair Step22(it.value.toInt()) } }.toList() + + for ((si, seam) in seamsText.split("\n").withIndex()) { + val (fromRange, toRange, fromDir, toDir) = seam.split(";") + val from = parseCoordinateRange(fromRange) + val to = parseCoordinateRange(toRange) + val fd = Direction.valueOf(fromDir) + val td = Direction.valueOf(toDir) + for (i in from.indices) { + val f = from[i] + val t = to[i] + val fromTile = tiles[f.y][f.x] + val toTile = tiles[t.y][t.x] + + if (fromTile is RealTile22) { + when (fd) { + Direction.L -> fromTile.left = Seam22(toTile, td) + Direction.U -> fromTile.up = Seam22(toTile, td) + Direction.R -> fromTile.right = Seam22(toTile, td) + Direction.D -> fromTile.down = Seam22(toTile, td) + } + } + if (toTile is RealTile22) { + when (td.opposite()) { + Direction.L -> toTile.left = Seam22(fromTile, fd.opposite()) + Direction.U -> toTile.up = Seam22(fromTile, fd.opposite()) + Direction.R -> toTile.right = Seam22(fromTile, fd.opposite()) + Direction.D -> toTile.down = Seam22(fromTile, fd.opposite()) + } + } + + debug[f.y][f.x] = si.digitToChar() + debug[t.y][t.x] = si.digitToChar() + } + } + + // Debug output + println(debug.joinToString("\n") { it.joinToString("") }) + for (t in tiles.flatten().filterIsInstance()) { + if (t.up is VoidTile22) println("Error: (${t.x},${t.y}).up is void!") + if (t.right is VoidTile22) println("Error: (${t.x},${t.y}).right is void!") + if (t.down is VoidTile22) println("Error: (${t.x},${t.y}).down is void!") + if (t.left is VoidTile22) println("Error: (${t.x},${t.y}).left is void!") + } + return Pair(Board22(tiles), instructions) } + +private fun parseCoordinateRange(rangeText: String): List { + val (minX, minY, maxX, maxY) = rangeText.split(',', '-').map(String::toInt) + val results = mutableListOf() + for (y in between(minY, maxY)) { + for (x in between(minX, maxX)) { + results.add(Coordinate(x, y)) + } + } + return results +} + +private fun between(from: Int, to: Int) = if (from < to) from..to else from downTo to diff --git a/src/main/kotlin/me/gergo/coordinates.kt b/src/main/kotlin/me/gergo/coordinates.kt index 6d56fc2..0ef0ae3 100644 --- a/src/main/kotlin/me/gergo/coordinates.kt +++ b/src/main/kotlin/me/gergo/coordinates.kt @@ -16,6 +16,13 @@ enum class Direction { R -> U D -> R } + + fun opposite() = when (this) { + L -> R + U -> D + R -> L + D -> U + } } data class Coordinate(val x: Int, val y: Int) diff --git a/src/main/resources/input22-part1.txt b/src/main/resources/input22-part1.txt new file mode 100644 index 0000000..e360a5e --- /dev/null +++ b/src/main/resources/input22-part1.txt @@ -0,0 +1,210 @@ + ....##...#...........#....#.......................#......................#..........#............... + .......#....##..#.......#......#..#...#..#...........................................#...........##. + ...#..#.......................#....#.#..#.#..................#...........#.#..#.....#.......#..#.... + ....#.#...........#..#...........#......#...#.........#...#...#......##....#..#..................... + ..#...................#.......#............#.........#.....#......................#.........#....... + ........#......................................#..........................#........#..#....#........ + ............#.#.....#....................#...##....#.................#...#......#..#...#..........#. + .#....#..........#.............................................#...#.....................#.......... + ..#.....................................##..............#.........#.............##...#..#....#...##. + .#........#..#..................#............##.......#........#......#...#......#.......##..##..... + .#..#......................#.......................#.....................#.....#..#....#.......#.... + .......#...................................................................................#........ + ........#.....................#..#.....##......................##..........#.#.........#..........#. + ...#...................#....#.....................#.......#.#..............................#........ + .........#................#...#.#....#......#.................#....#...#..........#................. + .............#...#.....#..#.#.......................#...........#......#.....#.....#......#..#...##. + ....#.........#.#..................#.......#..#..#......#......#...................#.............##. + ...#..........#................#..#.#...............................#............................... + .#................#.............................#..#..........#.#.............#.............#....... + ..#..................#....#...............................#........................#.......#.....##. + ...#.##....###.......#...............#....................#.#....#......................#.#......... + .........................#...........#.......................#.................#......#............. + ...#....#.#.................#..............#..............#...........................#.........#... + ..#.......#........#.......#...........#..#.....#.......#..##.............#...#..................#.. + .........##...##............#.........#.......#.#..............#....................#......###...... + ...........................#....#...............#.....##....#...............................#.....#. + ...............................#.......#..............#....###.............#......#.#............... + .#.......#.#................#..........#..#....#.#....................#...##...#...#.##............. + ........#...................................#..................#.......#..#.#.......##........#..... + #.........................#...#................#......##....#............................#.#.#...... + ..#.......#..................##.........#....#.............#.#..........#................#.......#.# + ......#.....#.........#...................#..................#...........#.........#.#.......#...... + ..........#..................#.......#......#......##.#...........#..#.##.......#................... + ....#...##......#......#.......................#............#........###...............#.#....#..#.. + ...###................#........#.#...............#..#...............................#.......#....... + ......................................##...........................#........................#.....#. + ..................#............#.......#..........#...........#...........................#...#.#... + #..........##...................#...........................................#......................# + .#...#..#..........................#..............................................#...#.......#..#.. + #.#................#..........#...#...#...............#.#.......##...............................#.. + ......#........##.....#......#.........#..........##......#........#..........#..................... + ..#..##............#.........#.........#.....#.#..#..#.............##....................##..#...#.. + ...........#.#........#......................#..##....................#......#............#.....#... + ..#.....#......#......#...#...#...............#........#.........###.....#.............#............ + ..#.....##...............#........#...............#.........................#..........#........#..# + ......................#...##.....##..#.......#.#.#...............#.....#..#...#........#............ + ...........#.......##.............#..................#..........................#...#....#.......... + ......##........#........#....#............#.........#................#.......#..................... + #..#........#..#........................#..........#................................................ + .#........#......................................................#...#.#...........#...#..#...#..... + ......#.....#..........#...............#...#...... + ........##............#.......#...#........#...... + .............#....#...................#.##........ + ........#................#.......#......#.....#... + ....#.....#............#.....#..##........#....... + ...........#.......#..###..................#...... + .....#....##...................#....#...##..#....# + .........#...#.....#....#...#..................... + .##.............................#.#....#.......... + ....#....................##............#.......... + .#..........#...........................#.#....... + .............##..................#...#...#.......# + .....................#..........#..........#...... + ......#.......#............#.#...........#........ + ........##....#...........#.#...............##.... + .....#....#..................#..#......#..#....... + .#..##..#...........................#............. + .......#....#....##...#.........................#. + .#......#..........#...................#.......... + .#....#......#.................#.....#..#..#.....# + #......#....#..#............#...#...#.........#... + .....#.........#..................#.#..#.....#.... + #..........#.....#..#..#....#.......##............ + ............#......#...............#...#.......... + ##.........#.......................#...#......#... + .......###..#.#.......#.........#.............#... + ............#.............##.#.....#...#........#. + .#.......#......##...........#........#.......#... + .................................#...#......##..#. + ..#.....#...##....................#............#.. + ...............................#..#......###.#.... + .......#....##.......#............................ + ............#.............................#...#... + ...............................#.....#............ + .....#...#.......#.##......#.....#............#### + ..#.............#........#.................##..... + ......#.........................................#. + .........#..........................#.#........... + ..#....#......#...#..#...#...#.#...........#.#..#. + #...............#...........#.......#....#.....#.. + .........#.#....#.........#.##....#......#..#..... + .....#......#...........#.#.#.........#..#........ + ..#..#.......................................#.... + #..#...........................................#.. + .......#........#..#..........#....#..#........... + ................#.#.........................#...#. + .......#.......#...#....#....#....#.#.....#.#....# + .#.#....#.#....#...................#..##.......#.. + ....#........#..#.........................#....... + .....#...#..........#.##...#...........#.........# +#..............#.....#.............................#...........................#.......#.......#.... +......###...#...#.......#......#.#..................#..#.......#.............#.....#............#... +...........#.....#.......#....#......#..##......................##.....#............##....#......##. +...........#..#.......#...#......#....#....#........#................##.#.........#................. +..#....#.#......##.......................#....#..................................#.................. +........#.#.#...#...............#......##.....#...................#..#.#............................ +........#........................#....#............#..........................#..................... +.......#..#..#.#...................................#...#.........#......#........................... +................#.....###............#..................#...................#...#.........#......... +#.......#....................#.#.#.........#......#.........#.....#..#....##......................#. +..###.......#..##.......#.........#........#.#......#..#.........................#..#......#.......# +.....#......#..............#......#.#...###.......#.................#.......#.............##........ +............................#............##.......#..#......#....#.......#..#......#................ +......#........#....#...#..........#.#.....#........#..................#.................#.......... +..#......#........#..#.##.#.......................#.#...#.#..........#.....................#........ +.......#...........#.#.....................#.................#...##...........#..................... +.#..#.#.#...#......#.........#............#..#...................#...........#.#..............#..... +..#....#.....#.#.........##..........#......##.....#....#.........#.#..........##...#...##........#. +....#.....................#...#..............#.....#.........................##........#............ +..#...#....#..#.......#.................#......................##........................#.......#.. +...#...................#.........................#..................................#...#....#...... +....................#....#.........#.#....#...............................#......#......#.#.##...... +...#..............#...............#..........#.........#...#........#..............................# +....#..........#.##............#..............#..#........................#..#.....#.........#...... +#................#.................#..#.#...........#.........#...........#...#.........#........... +....#.......................#............##.....#..##.......................................#....... +.....#........#...................#........#.......#....#.............#...........#................. +................#...#.......#...........#.....#..#..#...#............#...#...........#.............. +.#..........#...................#...#.........................#...##.............................#.. +....................................#..........#.........##.....##..............#................... +...#.#.#.#.................................#....#....#...#......###..........#........##..........#. +..#..#......#.......#...#..#..............................#..#....#..#...........##................# +.#.................##............#......................#................................#....#..... +.................##...#.....................#.....#......#....#....#..#..........#.....#.#.....##... +....#.......#..#........#...........#...#.#...#...##............#..............#...................# +......##..#........#...#.....#..#......#.........#................#..............#..........##...... +...................................#.#......................#....#.........#..........#.........#... +..........#..............#.#...#.............#..............................#..........#............ +...................#................##..#..........#......................#....#.#.#.......#........ +...........#............#.#...##.....##..................#.#......................#................. +...........#..............#..................#......#............#........#..............#....#..... +.......#................................#..#..................#.....#............................#.. +...........#.........#...................#....................#...............#..................#.. +.#....#..#....#........#............##...........#..#........#.#...#.#..#..#........................ +...............#.........#.......#.......#...............#.#.##..........................#.....#.... +....#...........#..#..#.#...#....#............#.........#..........#...#..........#..............#.# +......#..........##....................##...............#........................................... +.....#.....#.......#........#.....#........................#..#..............#.#.#.#...#...........# +.#...........##...........#...............#..........###...#................................#....... +.#......#..#.#...#...............................#....#........#..................#.....#..#...#.... +..........#.....#.....#...#....#.................. +................#......................#.......... +...............#...#...#..............#.........## +..#..........#.#...........................#...... +............#..#.........#.........#.##........... +..#..........................#..........#...#..... +.#...............#.........##............#........ +...#.#.......#......................#............. +....................#.#..........#.............#.. +.........#......#...#.#.....#................#.#.. +.......#...#.#..............................#..... +................#...................#.........#... +##..............#.................##.............. +..#....#.......#.......#.....##..........#...#.... +...#..........................#......#.#.#........ +..................#.......#.#......##....#...#.... +#..........#..#................................... +................................#.......#.#.#....# +........#........#......#........................# +##....#..#..........#................#.#.......... +.##...........#...................#.....#......... +.........#.#.#...#......#...#....#.....#.#.....#.. +.............................#.........#.......... +............................#.............#....... +......................#.....####.......#.......... +........#..............................#....#..... +.#.#....#..........#.........#...#......#..#...... +..##..................#.#.........#..............# +..................#...................#.....#..### +..#.....#.....#......#...........#.#..#........... +......#......#...#..#.....#...........#.#..##..... +......#..#.........................#.......#...#.. +......#..#............##..................##...... +......#...................#......#.##........#.... +.......#............................#............. +...................#....#............##...##...... +.................................................# +....#.........#...#...............#.......#..#.... +....#.....#.....................###...#..#........ +.#....#...#.....#..#........##.....#.#..#......#.. +.......#......#..............#.................... +.......#...................#.....................# +........................#................#.......# +.#......#.............#.......#..........#........ +............#..#....#...#......#.......#.......... +###.........#............#..........#.........#... +......#..#.............#...#........#......#..##.. +..#.........#................................#.... +..#.#...............#..#..#........#.....#........ +.....##.#......................................... + +8R20R15L48L25L44R11L23R3L19R8L10L13R28L19R13R46R8R9R24L33L49L21R26R46L4L7L46L49L50R3L39L13L6L8R23R30L12L18L38L3R22R38R29L6L3L27R30R6R37R25R23R40L6L34L27R29L33L20R15R16R32L40R44R11R11R35L23R24R42R31L3R36R5R19L41L38R22L46R17L40R22L35L14L23R27L40L9L21L10R38R26R39L47R31R19L28R13R28R15R28L7L41R36L42L5L13R1R48L2R44L31R14R20L28R6R31R45R49L36L47R5R23L44L8L40R7R46L15L34L36R18L34L18R48L1R18R37R44R39R4L37L21L44R47L3R29R21L49L19R37L48R2L44R30R44R39L20L5R30R32L42L36R23L5R9R9R18L24L7L32R32L30L24L35L10L2L30R12L13R46L31L4L28L22L31L46L36L11L2R6R21L45L27L6L17L34R32L44R44L16R36L47R28L46L22R49R50R38R17L29R49R44R33L37L44L11R24R50L46R7L14R25R7L34R28L7R23R17R19R17L15R23R43R17L46R13R8L22L42L25R26R48L9R47R17L46L39R40R27L28R20R23L15L22L10L16L32L32L3R37R1R14R50R5L44R7R25R4R3R30L32R21L20L14L42R31L38R47L47R45L48L7L32R39L24R21L4L23R31R13R24R14R45L50R15L8L13L3R43R23R14R42L50L10R25L4L36R48L8L26R10L2R9L47L12R46R17L43L33L8L40L45R30R14R47R23L1L43L6R17L50L50L25L6R43L9L2L13L4L46L47R2R18L3R31R49L28R45R32R3R7R43R30R21R36R22L42L40R19R19R45R45R8L36L17L4L19L31R44L44L25L44R50R4L3R49L24L22L35L5R35L15R47L47L25R28R29L27L28L4L49R45R16L43L45L18L38L14L4R8R20L6L9L24R13L20L48L11R42L18L40R27L2L15R50L18L6L3R31L17R45R11L10R41R31R14R28R47L41L36R10L39R41L35L11L37R22R45R13L39L49L20L25R31R15R42R15R27R34R11R27L47L29L11R34L11R2L14R35L23R36R35L19R35R40R21L18L16L11R3R17L50R47L2L29L1R14R33R29L30L32L26L4L1L13L34R14R34R21R4R5R50R49L38R23R37R3R46L44R11R20R24R34L19L22R49L3L36R18R36R20L37R29L29L7R37L5L22L49L5L16R34R41L45L50R50R38R45L27L40R39L22L31L39L8L33L45R35R16L28R4R21L16R46R17L16L45R29R17L30L17R8R6R27L24R17L35R33L14R5R31L46L8L11R50L30L21L11L38L18L34R38L4L22L25L40L24L20L27L28L15L36L1L29L25R29L47R3L32L39L23R14R32R47R46R13L18R2R27R30R7L47L2L42R6R28R20L44L40L48R46L37L27L17L27L1R9R22R9L19R10L19R3R31L35R11R32R18L17L11R4L27L30L32L44L39R25R39R41R48L22L26R31L42L15L31L26R48R45L48R14R28R50L31L12L9R33L36L38R11L7R4R11R45R17R20L27L19R35R42L6R40L41R7L17L15R5R18L39R2R28R50R45R7R41L20L48L32R20R23L2L27L10L30R7L7L18R47R32L49L11L38L39L50L9R47R13R21R42L10L5R21L37R18L41L45R20R8L30L18R21L2R8L16R16R49L43L43L10R36L41R12L34L41R6L12L9L34R2R39R40L6L47L32R19R1L38L36R43R41L47R34L25L22R32R21R47R18R4R36L37R22R36L19L11L36R15L35R39R39R32R3L9L5L28L25L39L39R30L48L1R7L8R24R42L4L2L26R34R31R21L25L12L29L10R23L6R47R33L32L22L27R41L43L38R9R13R17R39L42L31R44L15L13R14R48L13R8R20R1R10R22L40L26L36R18R44L8R32L20R5L22R24L22L26R50L41R29L3R29L11R45L5R24R31R20R41R35R37R9L39L24L9L36R14L8L27L38L37L29L9R22R47L35L36R48L35R46R16L11R23L17R35L18R14L25L32L50R33R46L10L40R17L9R35R7R41R42L11L1R11L20R28L44R45R36L23R23R24L22L15L25R27R27R21L45R18R33R15R46L8R7L26L45R20R45L37L48L33L49R28L8L20L12R38R25L17L4L26R20R11L32L32R6R12L2R30R8R44R10R29L49R28R40R42L42R42L6R1L9R30R27R47R46L22L21L36L33R41R33R34R35R14L6L46L21L46L9R34L35L19R32L20L40L31R23R3L5L42L9R2L44R41R21R45L41L21L33R22R11L37L39L19L28L32L22R32R43R16R26R15L20L6R40L47L40R26R2R29R1R39R1L19R37L39L28R3R32R8R22L19R35R27R29L28R14R4R41L30R31L20R40L2L41L17L2R6R22R45L19L20R45L18L44R15R1R21L42L5R47L29R9L6R34L38R39R41L25L16R4L35L34R45L8R39R1R25R43L17L41L20L50L17L18L1L24R24R24R28R27R8R50R5L3L6R22R34L25R41R33L37R45L33R2L37L35R3L26L47R27R21L21R6R10R30R41L34R13R5R44R34L48L19R47L22R39L47R45L3L26L49L30L49L8L23R5R45R6R43R29R35R14L49R6L33R16R24R15R26R3R8R25L41L12L42L3R24R41R26R39R3L32L14R31L5R41R27L22R26R38R29L37R31L17L38L27R7R16L23R32L16R43L2R50L39L24R26R25R31R34L45L49R31L21L25L29R44R33R32L42R9L42R6L23L37R36R25L27L33R28R23R30R35R44R14L25R28L5L33L5R10R33L50L11R45L2L29L18L14L35L31R19L24R45R26L12R43R37L43R50R44L41R18L31L46R48R33L48R3R26R24R27R9L37R40R1L2L24L13L29L14R24L37R49R44R32R27L40R20R11L34L40R48R34R38R23L36L3L23L37R4R44R40R35R9L29R31R40L10L49L1L25R46R42L49L9R38R36R34L28R25R32L26R12R30L48L1L20L23R8L6L21R20L13L16L15R37R6R45L14R40R34R8L10R28L45R44R47L35L11L19L25R19L35L15R20L26L30R26L23R34R16L45L1R16L50L44R38R34R2R42R8R50R30R15L3R24R11L13L3R7R46L25R3R48L5L19R4L4L34L11R4R29L46R3R9R18R17L49L18L47L37R38R3L27R35L46R22R29R13R28L25R6R9L48L19L33L26L40L37L5R35R19L37L2R22L5R42L5R12R37L27R23L26L15L29R32R20L17L30R27R4L14R7L21R43L39R46R28R44L36L39L2R9L33L12R40L3R16R6R28L25R47R32R27R44L3R42R17R12L42R43L49L17R25L41R40L28R16L4L35R45L10R6R21R19R16R44L40L44R33R17R22L8L14R33L9R8L28R50R1R39R2L6L3L22L50R22L31R7L31L14L39L44R10R48L18R22L37R1R45R13R38R19L48L3L5L23R44L28R13L14R2R37L29L25L17L49L15L26R35L20R11R9L43R32R40L39L27R29L16L50R40L14R8L15R39L36R6L7R30L7R49R2R46R27L1R12R35L28R10L45R16R5L2R8R29L42R35L35R15R37L15R3R7R34L50R11R6L23L29L31R50L14L25L13L23L40L48R48R33L29R17L34L27R10L34R7R25R24R49L47L4R15R12R39L50R45L37R15L16R37R25R25R46L16L21R5R15R22L24R4R50L30R13R24L43R17L41R26L32R34R2R31R46R10R20L29L25R21L13L10R22R40L19L14R3L19R16R44R36R35R37R23R23R32R24L44R46L27R47R22R21L35L47L40L26R8R28L27L40R16L5R31R14R24R49R34L50R34R2R13R27R36L46L20L40R2R50R7L35L13R15R15R33R9L41L39R11L14R6L23L5R6L5L7L27R18L17L10L24L34L22R27L25L2L19L40R6L13R45R11R36L27R7R27L2R33L31R29L25R44R10L9L13R41L6L17R11L6L13R6R37R47R6L22R34R34L49L30R20R13L19R44L35L29L8L26R31L21L7R41L26L20R18R7L15R18R9L6L21L6R38R28R18R45R30L46R17L8R43R23L12R37L42R17R16L21R10R46L37R18R13L31R3R44L12L13R22L50R35R17L10R16R48R43L11R3L37L18R42R5R8R35L47R4R19L39L16L45L10R7L5L19L22L49L33L18L30L42R7R17R6L31L42R16R11R9L35R17L14L1L48L36L20L28R39R3R21L25L43L1L23R6L6R43L20R14L49R38L35L2L32L14L30L20L12R40R20L22R7L38L36R31R18L44L32L25R29L13R34L1R50L12R3R14L27L21R12L4R20L46R34L19L26R18L9R21L30L50R23L20L31R14L24L14R21L10R15L50L23L19L17L29R30R19L29R40L13L46R26R5R49R43R21L26R34R20R4L6R21L38L17R2R47R1L11R34R7L26R1L22R45R2L24R44L19L25L4R7R24L40L47R29L27R18L28L19R26L15L7L35R36R24R1L10L38L28R26R22R26R25R36R17R50R33R39R4R8R9R15R36L1R26L45L37R4L38L37L20R12L2L41R2R17R27R43R22R10R34R34R44R47R33R7R39R3R36R18L45R29R2L4R1R47L16R30R31R18L49 + +50,0-50,49;149,0-149,49;L;L +50,50-50,99;99,50-99,99;L;L +0,100-0,149;99,100-99,149;L;L +0,150-0,199;49,150-49,199;L;L +50,0-99,0;50,149-99,149;U;U +100,0-149,0;100,49-149,49;U;U +0,100-49,100;0,199-49,199;U;U \ No newline at end of file diff --git a/src/main/resources/input22-part2.txt b/src/main/resources/input22-part2.txt new file mode 100644 index 0000000..3a1ef7b --- /dev/null +++ b/src/main/resources/input22-part2.txt @@ -0,0 +1,210 @@ + ....##...#...........#....#.......................#......................#..........#............... + .......#....##..#.......#......#..#...#..#...........................................#...........##. + ...#..#.......................#....#.#..#.#..................#...........#.#..#.....#.......#..#.... + ....#.#...........#..#...........#......#...#.........#...#...#......##....#..#..................... + ..#...................#.......#............#.........#.....#......................#.........#....... + ........#......................................#..........................#........#..#....#........ + ............#.#.....#....................#...##....#.................#...#......#..#...#..........#. + .#....#..........#.............................................#...#.....................#.......... + ..#.....................................##..............#.........#.............##...#..#....#...##. + .#........#..#..................#............##.......#........#......#...#......#.......##..##..... + .#..#......................#.......................#.....................#.....#..#....#.......#.... + .......#...................................................................................#........ + ........#.....................#..#.....##......................##..........#.#.........#..........#. + ...#...................#....#.....................#.......#.#..............................#........ + .........#................#...#.#....#......#.................#....#...#..........#................. + .............#...#.....#..#.#.......................#...........#......#.....#.....#......#..#...##. + ....#.........#.#..................#.......#..#..#......#......#...................#.............##. + ...#..........#................#..#.#...............................#............................... + .#................#.............................#..#..........#.#.............#.............#....... + ..#..................#....#...............................#........................#.......#.....##. + ...#.##....###.......#...............#....................#.#....#......................#.#......... + .........................#...........#.......................#.................#......#............. + ...#....#.#.................#..............#..............#...........................#.........#... + ..#.......#........#.......#...........#..#.....#.......#..##.............#...#..................#.. + .........##...##............#.........#.......#.#..............#....................#......###...... + ...........................#....#...............#.....##....#...............................#.....#. + ...............................#.......#..............#....###.............#......#.#............... + .#.......#.#................#..........#..#....#.#....................#...##...#...#.##............. + ........#...................................#..................#.......#..#.#.......##........#..... + #.........................#...#................#......##....#............................#.#.#...... + ..#.......#..................##.........#....#.............#.#..........#................#.......#.# + ......#.....#.........#...................#..................#...........#.........#.#.......#...... + ..........#..................#.......#......#......##.#...........#..#.##.......#................... + ....#...##......#......#.......................#............#........###...............#.#....#..#.. + ...###................#........#.#...............#..#...............................#.......#....... + ......................................##...........................#........................#.....#. + ..................#............#.......#..........#...........#...........................#...#.#... + #..........##...................#...........................................#......................# + .#...#..#..........................#..............................................#...#.......#..#.. + #.#................#..........#...#...#...............#.#.......##...............................#.. + ......#........##.....#......#.........#..........##......#........#..........#..................... + ..#..##............#.........#.........#.....#.#..#..#.............##....................##..#...#.. + ...........#.#........#......................#..##....................#......#............#.....#... + ..#.....#......#......#...#...#...............#........#.........###.....#.............#............ + ..#.....##...............#........#...............#.........................#..........#........#..# + ......................#...##.....##..#.......#.#.#...............#.....#..#...#........#............ + ...........#.......##.............#..................#..........................#...#....#.......... + ......##........#........#....#............#.........#................#.......#..................... + #..#........#..#........................#..........#................................................ + .#........#......................................................#...#.#...........#...#..#...#..... + ......#.....#..........#...............#...#...... + ........##............#.......#...#........#...... + .............#....#...................#.##........ + ........#................#.......#......#.....#... + ....#.....#............#.....#..##........#....... + ...........#.......#..###..................#...... + .....#....##...................#....#...##..#....# + .........#...#.....#....#...#..................... + .##.............................#.#....#.......... + ....#....................##............#.......... + .#..........#...........................#.#....... + .............##..................#...#...#.......# + .....................#..........#..........#...... + ......#.......#............#.#...........#........ + ........##....#...........#.#...............##.... + .....#....#..................#..#......#..#....... + .#..##..#...........................#............. + .......#....#....##...#.........................#. + .#......#..........#...................#.......... + .#....#......#.................#.....#..#..#.....# + #......#....#..#............#...#...#.........#... + .....#.........#..................#.#..#.....#.... + #..........#.....#..#..#....#.......##............ + ............#......#...............#...#.......... + ##.........#.......................#...#......#... + .......###..#.#.......#.........#.............#... + ............#.............##.#.....#...#........#. + .#.......#......##...........#........#.......#... + .................................#...#......##..#. + ..#.....#...##....................#............#.. + ...............................#..#......###.#.... + .......#....##.......#............................ + ............#.............................#...#... + ...............................#.....#............ + .....#...#.......#.##......#.....#............#### + ..#.............#........#.................##..... + ......#.........................................#. + .........#..........................#.#........... + ..#....#......#...#..#...#...#.#...........#.#..#. + #...............#...........#.......#....#.....#.. + .........#.#....#.........#.##....#......#..#..... + .....#......#...........#.#.#.........#..#........ + ..#..#.......................................#.... + #..#...........................................#.. + .......#........#..#..........#....#..#........... + ................#.#.........................#...#. + .......#.......#...#....#....#....#.#.....#.#....# + .#.#....#.#....#...................#..##.......#.. + ....#........#..#.........................#....... + .....#...#..........#.##...#...........#.........# +#..............#.....#.............................#...........................#.......#.......#.... +......###...#...#.......#......#.#..................#..#.......#.............#.....#............#... +...........#.....#.......#....#......#..##......................##.....#............##....#......##. +...........#..#.......#...#......#....#....#........#................##.#.........#................. +..#....#.#......##.......................#....#..................................#.................. +........#.#.#...#...............#......##.....#...................#..#.#............................ +........#........................#....#............#..........................#..................... +.......#..#..#.#...................................#...#.........#......#........................... +................#.....###............#..................#...................#...#.........#......... +#.......#....................#.#.#.........#......#.........#.....#..#....##......................#. +..###.......#..##.......#.........#........#.#......#..#.........................#..#......#.......# +.....#......#..............#......#.#...###.......#.................#.......#.............##........ +............................#............##.......#..#......#....#.......#..#......#................ +......#........#....#...#..........#.#.....#........#..................#.................#.......... +..#......#........#..#.##.#.......................#.#...#.#..........#.....................#........ +.......#...........#.#.....................#.................#...##...........#..................... +.#..#.#.#...#......#.........#............#..#...................#...........#.#..............#..... +..#....#.....#.#.........##..........#......##.....#....#.........#.#..........##...#...##........#. +....#.....................#...#..............#.....#.........................##........#............ +..#...#....#..#.......#.................#......................##........................#.......#.. +...#...................#.........................#..................................#...#....#...... +....................#....#.........#.#....#...............................#......#......#.#.##...... +...#..............#...............#..........#.........#...#........#..............................# +....#..........#.##............#..............#..#........................#..#.....#.........#...... +#................#.................#..#.#...........#.........#...........#...#.........#........... +....#.......................#............##.....#..##.......................................#....... +.....#........#...................#........#.......#....#.............#...........#................. +................#...#.......#...........#.....#..#..#...#............#...#...........#.............. +.#..........#...................#...#.........................#...##.............................#.. +....................................#..........#.........##.....##..............#................... +...#.#.#.#.................................#....#....#...#......###..........#........##..........#. +..#..#......#.......#...#..#..............................#..#....#..#...........##................# +.#.................##............#......................#................................#....#..... +.................##...#.....................#.....#......#....#....#..#..........#.....#.#.....##... +....#.......#..#........#...........#...#.#...#...##............#..............#...................# +......##..#........#...#.....#..#......#.........#................#..............#..........##...... +...................................#.#......................#....#.........#..........#.........#... +..........#..............#.#...#.............#..............................#..........#............ +...................#................##..#..........#......................#....#.#.#.......#........ +...........#............#.#...##.....##..................#.#......................#................. +...........#..............#..................#......#............#........#..............#....#..... +.......#................................#..#..................#.....#............................#.. +...........#.........#...................#....................#...............#..................#.. +.#....#..#....#........#............##...........#..#........#.#...#.#..#..#........................ +...............#.........#.......#.......#...............#.#.##..........................#.....#.... +....#...........#..#..#.#...#....#............#.........#..........#...#..........#..............#.# +......#..........##....................##...............#........................................... +.....#.....#.......#........#.....#........................#..#..............#.#.#.#...#...........# +.#...........##...........#...............#..........###...#................................#....... +.#......#..#.#...#...............................#....#........#..................#.....#..#...#.... +..........#.....#.....#...#....#.................. +................#......................#.......... +...............#...#...#..............#.........## +..#..........#.#...........................#...... +............#..#.........#.........#.##........... +..#..........................#..........#...#..... +.#...............#.........##............#........ +...#.#.......#......................#............. +....................#.#..........#.............#.. +.........#......#...#.#.....#................#.#.. +.......#...#.#..............................#..... +................#...................#.........#... +##..............#.................##.............. +..#....#.......#.......#.....##..........#...#.... +...#..........................#......#.#.#........ +..................#.......#.#......##....#...#.... +#..........#..#................................... +................................#.......#.#.#....# +........#........#......#........................# +##....#..#..........#................#.#.......... +.##...........#...................#.....#......... +.........#.#.#...#......#...#....#.....#.#.....#.. +.............................#.........#.......... +............................#.............#....... +......................#.....####.......#.......... +........#..............................#....#..... +.#.#....#..........#.........#...#......#..#...... +..##..................#.#.........#..............# +..................#...................#.....#..### +..#.....#.....#......#...........#.#..#........... +......#......#...#..#.....#...........#.#..##..... +......#..#.........................#.......#...#.. +......#..#............##..................##...... +......#...................#......#.##........#.... +.......#............................#............. +...................#....#............##...##...... +.................................................# +....#.........#...#...............#.......#..#.... +....#.....#.....................###...#..#........ +.#....#...#.....#..#........##.....#.#..#......#.. +.......#......#..............#.................... +.......#...................#.....................# +........................#................#.......# +.#......#.............#.......#..........#........ +............#..#....#...#......#.......#.......... +###.........#............#..........#.........#... +......#..#.............#...#........#......#..##.. +..#.........#................................#.... +..#.#...............#..#..#........#.....#........ +.....##.#......................................... + +8R20R15L48L25L44R11L23R3L19R8L10L13R28L19R13R46R8R9R24L33L49L21R26R46L4L7L46L49L50R3L39L13L6L8R23R30L12L18L38L3R22R38R29L6L3L27R30R6R37R25R23R40L6L34L27R29L33L20R15R16R32L40R44R11R11R35L23R24R42R31L3R36R5R19L41L38R22L46R17L40R22L35L14L23R27L40L9L21L10R38R26R39L47R31R19L28R13R28R15R28L7L41R36L42L5L13R1R48L2R44L31R14R20L28R6R31R45R49L36L47R5R23L44L8L40R7R46L15L34L36R18L34L18R48L1R18R37R44R39R4L37L21L44R47L3R29R21L49L19R37L48R2L44R30R44R39L20L5R30R32L42L36R23L5R9R9R18L24L7L32R32L30L24L35L10L2L30R12L13R46L31L4L28L22L31L46L36L11L2R6R21L45L27L6L17L34R32L44R44L16R36L47R28L46L22R49R50R38R17L29R49R44R33L37L44L11R24R50L46R7L14R25R7L34R28L7R23R17R19R17L15R23R43R17L46R13R8L22L42L25R26R48L9R47R17L46L39R40R27L28R20R23L15L22L10L16L32L32L3R37R1R14R50R5L44R7R25R4R3R30L32R21L20L14L42R31L38R47L47R45L48L7L32R39L24R21L4L23R31R13R24R14R45L50R15L8L13L3R43R23R14R42L50L10R25L4L36R48L8L26R10L2R9L47L12R46R17L43L33L8L40L45R30R14R47R23L1L43L6R17L50L50L25L6R43L9L2L13L4L46L47R2R18L3R31R49L28R45R32R3R7R43R30R21R36R22L42L40R19R19R45R45R8L36L17L4L19L31R44L44L25L44R50R4L3R49L24L22L35L5R35L15R47L47L25R28R29L27L28L4L49R45R16L43L45L18L38L14L4R8R20L6L9L24R13L20L48L11R42L18L40R27L2L15R50L18L6L3R31L17R45R11L10R41R31R14R28R47L41L36R10L39R41L35L11L37R22R45R13L39L49L20L25R31R15R42R15R27R34R11R27L47L29L11R34L11R2L14R35L23R36R35L19R35R40R21L18L16L11R3R17L50R47L2L29L1R14R33R29L30L32L26L4L1L13L34R14R34R21R4R5R50R49L38R23R37R3R46L44R11R20R24R34L19L22R49L3L36R18R36R20L37R29L29L7R37L5L22L49L5L16R34R41L45L50R50R38R45L27L40R39L22L31L39L8L33L45R35R16L28R4R21L16R46R17L16L45R29R17L30L17R8R6R27L24R17L35R33L14R5R31L46L8L11R50L30L21L11L38L18L34R38L4L22L25L40L24L20L27L28L15L36L1L29L25R29L47R3L32L39L23R14R32R47R46R13L18R2R27R30R7L47L2L42R6R28R20L44L40L48R46L37L27L17L27L1R9R22R9L19R10L19R3R31L35R11R32R18L17L11R4L27L30L32L44L39R25R39R41R48L22L26R31L42L15L31L26R48R45L48R14R28R50L31L12L9R33L36L38R11L7R4R11R45R17R20L27L19R35R42L6R40L41R7L17L15R5R18L39R2R28R50R45R7R41L20L48L32R20R23L2L27L10L30R7L7L18R47R32L49L11L38L39L50L9R47R13R21R42L10L5R21L37R18L41L45R20R8L30L18R21L2R8L16R16R49L43L43L10R36L41R12L34L41R6L12L9L34R2R39R40L6L47L32R19R1L38L36R43R41L47R34L25L22R32R21R47R18R4R36L37R22R36L19L11L36R15L35R39R39R32R3L9L5L28L25L39L39R30L48L1R7L8R24R42L4L2L26R34R31R21L25L12L29L10R23L6R47R33L32L22L27R41L43L38R9R13R17R39L42L31R44L15L13R14R48L13R8R20R1R10R22L40L26L36R18R44L8R32L20R5L22R24L22L26R50L41R29L3R29L11R45L5R24R31R20R41R35R37R9L39L24L9L36R14L8L27L38L37L29L9R22R47L35L36R48L35R46R16L11R23L17R35L18R14L25L32L50R33R46L10L40R17L9R35R7R41R42L11L1R11L20R28L44R45R36L23R23R24L22L15L25R27R27R21L45R18R33R15R46L8R7L26L45R20R45L37L48L33L49R28L8L20L12R38R25L17L4L26R20R11L32L32R6R12L2R30R8R44R10R29L49R28R40R42L42R42L6R1L9R30R27R47R46L22L21L36L33R41R33R34R35R14L6L46L21L46L9R34L35L19R32L20L40L31R23R3L5L42L9R2L44R41R21R45L41L21L33R22R11L37L39L19L28L32L22R32R43R16R26R15L20L6R40L47L40R26R2R29R1R39R1L19R37L39L28R3R32R8R22L19R35R27R29L28R14R4R41L30R31L20R40L2L41L17L2R6R22R45L19L20R45L18L44R15R1R21L42L5R47L29R9L6R34L38R39R41L25L16R4L35L34R45L8R39R1R25R43L17L41L20L50L17L18L1L24R24R24R28R27R8R50R5L3L6R22R34L25R41R33L37R45L33R2L37L35R3L26L47R27R21L21R6R10R30R41L34R13R5R44R34L48L19R47L22R39L47R45L3L26L49L30L49L8L23R5R45R6R43R29R35R14L49R6L33R16R24R15R26R3R8R25L41L12L42L3R24R41R26R39R3L32L14R31L5R41R27L22R26R38R29L37R31L17L38L27R7R16L23R32L16R43L2R50L39L24R26R25R31R34L45L49R31L21L25L29R44R33R32L42R9L42R6L23L37R36R25L27L33R28R23R30R35R44R14L25R28L5L33L5R10R33L50L11R45L2L29L18L14L35L31R19L24R45R26L12R43R37L43R50R44L41R18L31L46R48R33L48R3R26R24R27R9L37R40R1L2L24L13L29L14R24L37R49R44R32R27L40R20R11L34L40R48R34R38R23L36L3L23L37R4R44R40R35R9L29R31R40L10L49L1L25R46R42L49L9R38R36R34L28R25R32L26R12R30L48L1L20L23R8L6L21R20L13L16L15R37R6R45L14R40R34R8L10R28L45R44R47L35L11L19L25R19L35L15R20L26L30R26L23R34R16L45L1R16L50L44R38R34R2R42R8R50R30R15L3R24R11L13L3R7R46L25R3R48L5L19R4L4L34L11R4R29L46R3R9R18R17L49L18L47L37R38R3L27R35L46R22R29R13R28L25R6R9L48L19L33L26L40L37L5R35R19L37L2R22L5R42L5R12R37L27R23L26L15L29R32R20L17L30R27R4L14R7L21R43L39R46R28R44L36L39L2R9L33L12R40L3R16R6R28L25R47R32R27R44L3R42R17R12L42R43L49L17R25L41R40L28R16L4L35R45L10R6R21R19R16R44L40L44R33R17R22L8L14R33L9R8L28R50R1R39R2L6L3L22L50R22L31R7L31L14L39L44R10R48L18R22L37R1R45R13R38R19L48L3L5L23R44L28R13L14R2R37L29L25L17L49L15L26R35L20R11R9L43R32R40L39L27R29L16L50R40L14R8L15R39L36R6L7R30L7R49R2R46R27L1R12R35L28R10L45R16R5L2R8R29L42R35L35R15R37L15R3R7R34L50R11R6L23L29L31R50L14L25L13L23L40L48R48R33L29R17L34L27R10L34R7R25R24R49L47L4R15R12R39L50R45L37R15L16R37R25R25R46L16L21R5R15R22L24R4R50L30R13R24L43R17L41R26L32R34R2R31R46R10R20L29L25R21L13L10R22R40L19L14R3L19R16R44R36R35R37R23R23R32R24L44R46L27R47R22R21L35L47L40L26R8R28L27L40R16L5R31R14R24R49R34L50R34R2R13R27R36L46L20L40R2R50R7L35L13R15R15R33R9L41L39R11L14R6L23L5R6L5L7L27R18L17L10L24L34L22R27L25L2L19L40R6L13R45R11R36L27R7R27L2R33L31R29L25R44R10L9L13R41L6L17R11L6L13R6R37R47R6L22R34R34L49L30R20R13L19R44L35L29L8L26R31L21L7R41L26L20R18R7L15R18R9L6L21L6R38R28R18R45R30L46R17L8R43R23L12R37L42R17R16L21R10R46L37R18R13L31R3R44L12L13R22L50R35R17L10R16R48R43L11R3L37L18R42R5R8R35L47R4R19L39L16L45L10R7L5L19L22L49L33L18L30L42R7R17R6L31L42R16R11R9L35R17L14L1L48L36L20L28R39R3R21L25L43L1L23R6L6R43L20R14L49R38L35L2L32L14L30L20L12R40R20L22R7L38L36R31R18L44L32L25R29L13R34L1R50L12R3R14L27L21R12L4R20L46R34L19L26R18L9R21L30L50R23L20L31R14L24L14R21L10R15L50L23L19L17L29R30R19L29R40L13L46R26R5R49R43R21L26R34R20R4L6R21L38L17R2R47R1L11R34R7L26R1L22R45R2L24R44L19L25L4R7R24L40L47R29L27R18L28L19R26L15L7L35R36R24R1L10L38L28R26R22R26R25R36R17R50R33R39R4R8R9R15R36L1R26L45L37R4L38L37L20R12L2L41R2R17R27R43R22R10R34R34R44R47R33R7R39R3R36R18L45R29R2L4R1R47L16R30R31R18L49 + +0,100-49,100;50,50-50,99;U;R +50,49-50,0;0,100-0,149;L;R +0,150-0,199;50,0-99,0;L;D +0,199-49,199;100,0-149,0;D;D +49,150-49,199;50,149-99,149;R;U +99,100-99,149;149,49-149,0;R;L +99,50-99,99;100,49-149,49;R;U \ No newline at end of file diff --git a/src/main/resources/input22-test.txt b/src/main/resources/input22-test.txt new file mode 100644 index 0000000..20a31ce --- /dev/null +++ b/src/main/resources/input22-test.txt @@ -0,0 +1,21 @@ + ...# + .#.. + #... + .... +...#.......# +........#... +..#....#.... +..........#. + ...#.... + .....#.. + .#...... + ......#. + +10R5L5R10L4R5L5 + +0,4-7,4;0,7-7,7;U;U +0,4-0,7;11,4-11,7;L;L +8,0-8,3;11,0-11,3;L;L +8,8-8,11;15,8-15,11;L;L +8,0-11,0;8,11-15,11;U;U +12,8-15,8;12,11-15,11;U;U \ No newline at end of file