Data for Dataforce

This commit is contained in:
ctsk
2024-12-03 10:43:17 +01:00
parent 16b572d3fb
commit 49c817a0c1
11 changed files with 54 additions and 20 deletions

13
.aocbench.yaml Normal file
View File

@@ -0,0 +1,13 @@
version: 1
author: "ctsk"
language: "scala"
dockerfile: "Dockerfile"
code: "/code"
workdir: "/code"
runonce: "./mill aoc.assembly"
cmd: "java -jar ./out/aoc/assembly.dest/out.jar %day% %input%"
environment:
- AOC_BENCH=1
daypath: "aoc/dev/ctsk/aoc/Day%dayzero%.scala"
inputfile: "data/%dayzero%.in"
answerfile: "data/%dayzero%.out"

9
Dockerfile Normal file
View File

@@ -0,0 +1,9 @@
FROM eclipse-temurin:23-jdk-alpine
RUN apk add curl
COPY . /build
WORKDIR /build
RUN ./mill aoc.assembly

View File

@@ -0,0 +1,26 @@
package dev.ctsk.aoc
import dev.ctsk.aoc.days._
val solvers = Map[Int, Solver](
1 -> Day01,
2 -> Day02,
3 -> Day03
)
@main def main(day: String, input: String): Unit =
solvers.get(day.toInt) match
case Some(solver) =>
val (timings, solution) = solver.run(input)
sys.env.get("AOC_BENCH") match
case Some(_) =>
println(solution.p1)
println(solution.p2)
case None =>
println(f"Preprocessing: ${timings.prep}%24s μs")
println(f"Part 1: ${solution.p1}%15s ${timings.p1}%15s μs")
println(f"Part 2: ${solution.p2}%15s ${timings.p2}%15s μs")
case None =>
println(s"Day $day not solved")

View File

@@ -1,20 +0,0 @@
package dev.ctsk.aoc
import dev.ctsk.aoc.days._
val solvers = Map[Int, Solver](
1 -> Day01,
2 -> Day02,
3 -> Day03
)
@main def main(day: String, input: String): Unit =
solvers.get(day.toInt) match
case Some(solver) =>
val (timings, solution) = solver.run(input)
println(f"Preprocessing: ${timings.prep}%24s μs")
println(f"Part 1: ${solution.p1}%15s ${timings.p1}%15s μs")
println(f"Part 2: ${solution.p2}%15s ${timings.p2}%15s μs")
case None =>
println(s"Day $day not solved")

2
data/01.ans Normal file
View File

@@ -0,0 +1,2 @@
1223326
21070419

2
data/02.ans Normal file
View File

@@ -0,0 +1,2 @@
559
601

2
data/03.ans Normal file
View File

@@ -0,0 +1,2 @@
187833789
94455185