Skip to content

Commit

Permalink
Extract blink counts in 2024 day 11
Browse files Browse the repository at this point in the history
  • Loading branch information
sim642 committed Dec 11, 2024
1 parent 5e07310 commit be65a83
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
7 changes: 5 additions & 2 deletions src/main/scala/eu/sim642/adventofcode2024/Day11.scala
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,11 @@ object Day11 {

lazy val input: String = scala.io.Source.fromInputStream(getClass.getResourceAsStream("day11.txt")).mkString.trim

val part1Blinks = 25
val part2Blinks = 75

def main(args: Array[String]): Unit = {
println(countBlinkedStones(parseStones(input), 25))
println(countBlinkedStones(parseStones(input), 75))
println(countBlinkedStones(parseStones(input), part1Blinks))
println(countBlinkedStones(parseStones(input), part2Blinks))
}
}
6 changes: 3 additions & 3 deletions src/test/scala/eu/sim642/adventofcode2024/Day11Test.scala
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@ class Day11Test extends AnyFunSuite {
test("Part 1 examples") {
assert(countBlinkedStones(parseStones(exampleInput), 1) == 7)
assert(countBlinkedStones(parseStones(exampleInput2), 6) == 22)
assert(countBlinkedStones(parseStones(exampleInput2), 25) == 55312)
assert(countBlinkedStones(parseStones(exampleInput2), part1Blinks) == 55312)
}

test("Part 1 input answer") {
assert(countBlinkedStones(parseStones(input), 25) == 217812)
assert(countBlinkedStones(parseStones(input), part1Blinks) == 217812)
}

test("Part 2 input answer") {
assert(countBlinkedStones(parseStones(input), 75) == 259112729857522L)
assert(countBlinkedStones(parseStones(input), part2Blinks) == 259112729857522L)
}
}

0 comments on commit be65a83

Please sign in to comment.