Skip to content

Commit

Permalink
2024 - Day 19 - parse
Browse files Browse the repository at this point in the history
  • Loading branch information
fmmr committed Dec 19, 2024
1 parent 6185bae commit e46a227
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions src/main/kotlin/no/rodland/advent_2024/Day19.kt
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,11 @@ import no.rodland.advent.Day
// template generated: 19/12/2024
// Fredrik Rødland 2024

class Day19(val input: List<String>) : Day<Long, Long, List<String>> {
class Day19(val input: List<String>) : Day<Long, Long, Pair<List<String>, List<String>>> {

private val parsed = input.parse()
private val towels = parsed.first
private val designs = parsed.second

override fun partOne(): Long {
return 2
Expand All @@ -17,10 +19,11 @@ class Day19(val input: List<String>) : Day<Long, Long, List<String>> {
return 2
}

override fun List<String>.parse(): List<String> {
return map { line ->
line
}
override fun List<String>.parse(): Pair<List<String>, List<String>> {
val (towel, design) = joinToString("\n").split("\n\n")
val towels = towel.split(", ")
val designs = design.split("\n")
return towels to designs
}

override val day = "19".toInt()
Expand Down

0 comments on commit e46a227

Please sign in to comment.