Skip to content

Commit

Permalink
2024 - Day 15 - reformatted
Browse files Browse the repository at this point in the history
  • Loading branch information
fmmr committed Dec 15, 2024
1 parent d56982d commit d32c497
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions src/main/kotlin/no/rodland/advent_2024/Day15.kt
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,11 @@ class Day15(val input: List<String>) : Day<Long, Long, Pair<Pair<Pos, Cave>, 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<Pos> = when (d) {
Expand Down

0 comments on commit d32c497

Please sign in to comment.