diff --git a/src/main/kotlin/no/rodland/advent_2024/Day15.kt b/src/main/kotlin/no/rodland/advent_2024/Day15.kt index 8ce9745..1fb0532 100644 --- a/src/main/kotlin/no/rodland/advent_2024/Day15.kt +++ b/src/main/kotlin/no/rodland/advent_2024/Day15.kt @@ -18,16 +18,11 @@ class Day15(val input: List) : Day, Lis val gridCopy = grid.copy() var p = start directions.forEach { d -> p = gridCopy.move(d, p) } - return gridCopy.flatMapIndexed { y, row -> - row.mapIndexed { x, c -> - if (c == 'O') { - 100 * y + x - } else { - 0 - } - + return gridCopy + .flatMapIndexed { y, row -> + row.mapIndexed { x, c -> if (c == 'O') 100 * y + x else 0 } } - }.sum().toLong() + .sum().toLong() } private fun getRest(d: Direction, robot: Pos): List = when (d) {