Skip to content

Commit a35e2e8

Browse files
committed
[2025/8] Use split instead of regex
1 parent 9d38e3e commit a35e2e8

File tree

1 file changed

+3
-7
lines changed

1 file changed

+3
-7
lines changed

src/main/kotlin/adventofcode/year2025/Day08Playground.kt

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@ class Day08Playground(
1111
) : Puzzle(customInput) {
1212
private fun connectJunctionBoxes(): Sequence<Triple<Set<Set<Point3d>>, Int, Set<Point3d>>> {
1313
val junctionBoxes =
14-
input.lines().map {
15-
val (x, y, z) = junctionBoxRegex.find(it)!!.destructured
16-
Point3d(x.toLong(), y.toLong(), z.toLong())
14+
input.lines().map { line ->
15+
val (x, y, z) = line.split(",").map(String::toLong)
16+
Point3d(x, y, z)
1717
}
1818

1919
val sortedJunctionBoxPairs =
@@ -55,8 +55,4 @@ class Day08Playground(
5555
.third
5656
.map { (x) -> x }
5757
.product()
58-
59-
companion object {
60-
private val junctionBoxRegex = """(\d+),(\d+),(\d+)""".toRegex()
61-
}
6258
}

0 commit comments

Comments
 (0)