From d32c497016396283cd7f62b0c9f656814b97ac3e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fredrik=20R=C3=B8dland?= Date: Sun, 15 Dec 2024 12:47:35 +0100 Subject: [PATCH] 2024 - Day 15 - reformatted --- src/main/kotlin/no/rodland/advent_2024/Day15.kt | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) 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) {