More pretty
This commit is contained in:
@@ -27,15 +27,22 @@ def runSolver(solver: Solver, input: os.Path): Unit =
|
||||
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")
|
||||
println(f"==============================================")
|
||||
println(f"Day ${solver.day}%02d ---------------------------------------")
|
||||
println(f"Prep ${timings.prep}%38s μs")
|
||||
println(f"Part 1 ${solution.p1}%20s ${timings.p1}%15s μs")
|
||||
println(f"Part 2 ${solution.p2}%20s ${timings.p2}%15s μs")
|
||||
println(f"----------------------------------------------")
|
||||
|
||||
println(f"Total ${timings.total}%37s μs")
|
||||
|
||||
println(f"==============================================")
|
||||
|
||||
@main def main(day: String, input: String): Unit =
|
||||
val num = """(\d+)""".r
|
||||
day match
|
||||
case "all" =>
|
||||
solvers.foreach { case (day, solver) =>
|
||||
solvers.toList.sortBy(_._1).foreach { case (day, solver) =>
|
||||
runSolver(solver, os.Path(input, os.pwd) / f"$day%02d.in")
|
||||
}
|
||||
case num(_) =>
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
package dev.ctsk.aoc
|
||||
|
||||
case class Timings(prep: Long, p1: Long, p2: Long)
|
||||
case class Timings(prep: Long, p1: Long, p2: Long):
|
||||
def total: Long = prep + p1 + p2
|
||||
|
||||
case class Solution(p1: Object, p2: Object)
|
||||
|
||||
abstract class Solver(day: Int):
|
||||
abstract class Solver(val day: Int):
|
||||
def run(input: os.ReadablePath): (Timings, Solution)
|
||||
|
||||
def timed[A](solution: => A): (Long, A) =
|
||||
|
||||
Reference in New Issue
Block a user