Compare commits
2 Commits
66575c4320
...
a7ee9bd981
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a7ee9bd981 | ||
|
|
1d14e2f2b5 |
@@ -4,10 +4,9 @@ import dev.ctsk.aoc._
|
||||
import dev.ctsk.aoc.Direction._
|
||||
import scala.annotation.tailrec
|
||||
import scala.collection.mutable
|
||||
import scala.collection.parallel.CollectionConverters._
|
||||
|
||||
object Day06 extends Solver(6):
|
||||
def analyse(grid: Grid[Char]): Array[Array[Array[Int]]] =
|
||||
private def analyse(grid: Grid[Char]): Array[Array[Array[Int]]] =
|
||||
val skipMap = Array.fill(grid.height, grid.width, 4)(-1)
|
||||
for
|
||||
obstacle <- grid.find(_ == '#')
|
||||
@@ -43,9 +42,7 @@ object Day06 extends Solver(6):
|
||||
val next = cur.step
|
||||
grid(next.pos) match
|
||||
case Some('#') =>
|
||||
if seen.contains(cur) then return true
|
||||
seen += cur
|
||||
rec(cur.turnRight)
|
||||
if seen.add(cur) then rec(cur.turnRight) else true
|
||||
case Some(_) =>
|
||||
if next.pos == obstacle then return rec(cur.turnRight)
|
||||
if next.pos.x == obstacle.x || next.pos.y == obstacle.y
|
||||
|
||||
17
build.mill
17
build.mill
@@ -2,10 +2,25 @@ package build
|
||||
|
||||
import mill._, scalalib._
|
||||
|
||||
object aoc extends ScalaModule {
|
||||
import $ivy.`io.github.alexarchambault.mill::mill-native-image::0.1.29`
|
||||
import io.github.alexarchambault.millnativeimage.NativeImage
|
||||
|
||||
object aoc extends ScalaModule with NativeImage {
|
||||
def scalaVersion = "3.5.2"
|
||||
def ivyDeps = Agg(
|
||||
ivy"com.lihaoyi::os-lib:0.11.3",
|
||||
ivy"org.scala-lang.modules::scala-parallel-collections:1.0.4"
|
||||
)
|
||||
|
||||
|
||||
def nativeImageName = "aoc"
|
||||
def nativeImageMainClass = "dev.ctsk.aoc.main"
|
||||
def nativeImageClassPath = runClasspath()
|
||||
def nativeImageGraalVmJvmId = "graalvm-java23"
|
||||
def nativeImageOptions = Seq(
|
||||
"--initialize-at-build-time",
|
||||
"--no-fallback",
|
||||
"--enable-url-protocols=http,https",
|
||||
"-Djdk.http.auth.tunneling.disabledSchemes=",
|
||||
)
|
||||
}
|
||||
Reference in New Issue
Block a user