Skip to content

Commit

Permalink
🎨 format
Browse files Browse the repository at this point in the history
  • Loading branch information
twentylemon committed Dec 2, 2023
1 parent 0ffbf5d commit 98bc464
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/main/scala/org/lemon/advent/year2023/Day02.scala
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,15 @@ private object Day02:
def parsePulls(pulls: String): Seq[Seq[Dice]] = pulls.split(";")
.map(_.split(","))
.map(_.map(x => x.strip))
.map(_.map(dice => dice match
case s"$num $colour" => Dice(num.toInt, colour)
.map(_.map(dice =>
dice match
case s"$num $colour" => Dice(num.toInt, colour)
))
.map(_.toSeq)
.toSeq

def parse(input: String): Seq[Game] = input.linesIterator
.map(line => line match
.map(_ match
case s"Game $id: $games" => Game(id.toInt, parsePulls(games))
)
.toSeq
Expand All @@ -40,4 +41,3 @@ private object Day02:
.map(_.values)
.map(_.product)
.sum

0 comments on commit 98bc464

Please sign in to comment.