Skip to content

Commit

Permalink
2022: Adjust ktlint settings to code style
Browse files Browse the repository at this point in the history
  • Loading branch information
jp7677 committed Nov 15, 2024
1 parent 871f7f7 commit d69682e
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
3 changes: 3 additions & 0 deletions 2022/.editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,6 @@ ktlint_standard_function-signature = disabled
ktlint_standard_enum-wrapping = disabled
ktlint_standard_blank-line-before-declaration = disabled
ktlint_standard_statement-wrapping = disabled
ktlint_standard_class-signature = disabled
ktlint_standard_chain-method-continuation = disabled
ktlint_standard_condition-wrapping = disabled
3 changes: 2 additions & 1 deletion 2022/src/test/kotlin/Day05.kt
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,10 @@ private fun getStacksAndMoves(): Pair<List<ArrayDeque<String>>, List<Move5>> {
}

startingStacks.reversed().drop(1).forEach {
for (i in 1..numberOfStacks * 4 step 4)
for (i in 1..numberOfStacks * 4 step 4) {
if (it.length >= i && it[i].isLetter())
stacks[(i - 1) / 4].add(it[i].toString())
}
}

val moves = input.last().split(eol)
Expand Down
5 changes: 2 additions & 3 deletions 2022/src/test/kotlin/Day22.kt
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,8 @@ private fun Set<Coord22>.peekForCube(pos: Position22): Position22? {

private fun Set<Coord22>.isCorrectPlane(pos: Position22) = any { it.x == pos.tile.x && it.y == pos.tile.y && it.plane == pos.tile.plane }

private fun mapToOtherPlane(pos: Position22): Position22 {
return when (pos.tile.plane) {
private fun mapToOtherPlane(pos: Position22): Position22 =
when (pos.tile.plane) {
1 -> when (pos.direction) {
Direction22.UP -> Position22(Tile(0, pos.tile.x + 100, 6), Direction22.RIGHT)
Direction22.LEFT -> Position22(Tile(0, (pos.tile.y - 149).absoluteValue, 4), Direction22.RIGHT)
Expand Down Expand Up @@ -153,7 +153,6 @@ private fun mapToOtherPlane(pos: Position22): Position22 {
}
else -> throw IllegalArgumentException("${pos.tile.plane} - ${pos.direction}")
}
}

private fun getMapAndPath(includePlanes: Boolean = false) = getPuzzleInput("day22-input.txt", "$eol$eol").toList()
.let { it.first().split(eol) to it.last() }
Expand Down

0 comments on commit d69682e

Please sign in to comment.