feat: basic wrapper + days 1 to 3

This commit is contained in:
Xavier Morel
2025-04-29 19:21:48 +02:00
committed by installer
parent 6c2240960f
commit d937ef84bb
10 changed files with 181 additions and 10 deletions

View File

@@ -0,0 +1,31 @@
package days
import scala.io.Source
trait Day {
val number: Int
def getInput(): Option[String] = {
val resourcePath = getClass.getResource(s"day${number}.txt")
if (resourcePath != null) {
Some(Source.fromURL(resourcePath).mkString)
} else {
None
}
}
def solve(): Unit = {
getInput() match {
case Some(input) => {
println(s"Day: $number")
println(s"Part 1: ${part1(input)}")
println(s"Part 2: ${part2(input)}")
}
case None =>
println(s"Missing day $number input")
}
}
def part1(input: String): String
def part2(input: String): String
}