diff --git a/src/main/kotlin/no/rodland/advent_2023/Day14.kt b/src/main/kotlin/no/rodland/advent_2023/Day14.kt index 2dc69283..530d06f3 100644 --- a/src/main/kotlin/no/rodland/advent_2023/Day14.kt +++ b/src/main/kotlin/no/rodland/advent_2023/Day14.kt @@ -33,12 +33,12 @@ class Day14(val input: List) : Day> { return cycle.load() } - private fun List.rev() = map { it.reversed() } + private fun List.reverseEachLine() = map { it.reversed() } private fun List.load() = sumOf { it.load() } - private fun List.cycle() = tilt().rotateLeft().rev() - .tilt().reversed().rotateLeft().rev() - .tilt().reversed().rotateLeft().rev() - .tilt().reversed().rotateLeft().asReversed().rev() + private fun List.cycle() = tilt().rotateLeft().reverseEachLine() + .tilt().reversed().rotateLeft().reverseEachLine() + .tilt().reversed().rotateLeft().reverseEachLine() + .tilt().reversed().rotateLeft().asReversed().reverseEachLine() private fun List.tilt() = map { line -> collapsed(line) }