Skip to content

Commit

Permalink
2023 - Day 14 - better naming for fun: rev => reverseEachLine
Browse files Browse the repository at this point in the history
  • Loading branch information
fmmr committed Dec 14, 2023
1 parent ce9b32d commit f03047b
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/main/kotlin/no/rodland/advent_2023/Day14.kt
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,12 @@ class Day14(val input: List<String>) : Day<Int, Int, List<String>> {
return cycle.load()
}

private fun List<String>.rev() = map { it.reversed() }
private fun List<String>.reverseEachLine() = map { it.reversed() }
private fun List<String>.load() = sumOf { it.load() }
private fun List<String>.cycle() = tilt().rotateLeft().rev()
.tilt().reversed().rotateLeft().rev()
.tilt().reversed().rotateLeft().rev()
.tilt().reversed().rotateLeft().asReversed().rev()
private fun List<String>.cycle() = tilt().rotateLeft().reverseEachLine()
.tilt().reversed().rotateLeft().reverseEachLine()
.tilt().reversed().rotateLeft().reverseEachLine()
.tilt().reversed().rotateLeft().asReversed().reverseEachLine()

private fun List<String>.tilt() = map { line -> collapsed(line) }

Expand Down

0 comments on commit f03047b

Please sign in to comment.