From 1f355c44d6989a4a390dc047b6aec43102b2536e Mon Sep 17 00:00:00 2001 From: Natsu Kagami Date: Sun, 24 Dec 2023 00:02:42 +0100 Subject: [PATCH] Day 23 --- Day23.scala | 97 +++++++++++++++++++++++++++++++ inputs/day23.input | 141 +++++++++++++++++++++++++++++++++++++++++++++ run | 4 +- 3 files changed, 240 insertions(+), 2 deletions(-) create mode 100644 Day23.scala create mode 100644 inputs/day23.input diff --git a/Day23.scala b/Day23.scala new file mode 100644 index 0000000..9f9fb5d --- /dev/null +++ b/Day23.scala @@ -0,0 +1,97 @@ +package aoc.day23 + +import aoc._ +import aoc.direction._ +import scala.collection.mutable + +enum Cell: + case Path, Forest + case Slope(dir: Dir) +import Cell._ + +object Parser extends CommonParser: + import Dir._ + val slope = ('^' ^^^ Up | 'v' ^^^ Down | '<' ^^^ Left | '>' ^^^ Right) ^^ (Slope(_)) + val cell = '.' ^^^ Path | '#' ^^^ Forest | slope + + val line = rep(cell) ^^ (_.toArray) + +val bStr = lines.toArray +val board = bStr.map(Parser.parse(Parser.line, _).get).toArray + +def inside(x: Int, y: Int) = + x >= 0 && x < board.length && y >= 0 && y < board(0).length + +extension [K](m: mutable.Set[K]) + inline def withFound[T](k: K)(inline body: => T): T = + m += k + val res = body + m -= k + res + +// part 1 + +object longestPath: + var bestPathFound = 0 + val visited = mutable.Set.empty[(Int, Int)] + val intersections = mutable.Map.empty[(Int, Int), Seq[((Int, Int), Int)]] + val cache = mutable.Map.empty[(Long, Int, Int), Option[Int]] + + def options(followSlopes: Boolean)(x: Int, y: Int) = + val nexts = board(x)(y) match + case Path => Dir.all.iterator + case Forest => Iterator.empty + case Slope(dir) => if followSlopes then Iterator(dir) else Dir.all.iterator + nexts + .map(_(x, y)) + .filter(inside(_, _)) + .filter(board(_)(_) != Forest) + .toSeq + + @scala.annotation.tailrec + def walkUntilIntersection( + followSlopes: Boolean + )(last: (Int, Int), x: Int, y: Int, accum: Int): Option[((Int, Int), Int)] = + if x == board.size - 1 then return Some(((x, y), accum)) + val options = this.options(followSlopes)(x, y).filter(_ != last) + options match + case Seq() => None + case Seq((nx, ny)) => walkUntilIntersection(followSlopes)((x, y), nx, ny, accum + 1) + case _ => Some(((x, y), accum)) + + def getChoices(followSlopes: Boolean)(x: Int, y: Int) = + intersections.getOrElseUpdate( + (x, y), { + this.options(followSlopes)(x, y).flatMap(walkUntilIntersection(followSlopes)((x, y), _, _, 1)) + } + ) + + def apply(followSlopes: Boolean)( + x: Int, + y: Int, + accum: Int = 0 + ): Option[Int] = + if x == board.size - 1 then Some(accum) + else + getChoices(followSlopes)(x, y) match + case Seq() => None + case options => + // println(s"$x $y $accum $options") + visited.withFound((x, y)): + val res = options + .filter((p, _) => !visited.contains(p)) + .flatMap: + case ((nx, ny), dist) => + longestPath(followSlopes)(nx, ny, accum + dist) + .maxOption + res + +def part1 = + println(longestPath(true)(0, board(0).indexWhere(_ != Forest))) + +def part2 = + println(longestPath(false)(0, board(0).indexWhere(_ != Forest))) + +@main def Day23(part: Int) = part match + case 1 => part1 + case 2 => part2 diff --git a/inputs/day23.input b/inputs/day23.input new file mode 100644 index 0000000..447706d --- /dev/null +++ b/inputs/day23.input @@ -0,0 +1,141 @@ +#.########################################################################################################################################### +#.#...#...#.........#.........#####.......#...#.......#...#...#...#####...###...#...#...###...###...#...#...#.....#.....#.....###...###...### +#.#.#.#.#.#.#######.#.#######.#####.#####.#.#.#.#####.#.#.#.#.#.#.#####.#.###.#.#.#.#.#.###.#.###.#.#.#.#.#.#.###.#.###.#.###.###.#.###.#.### +#.#.#.#.#.#.#.......#.......#.....#.#.....#.#.#.....#.#.#...#.#.#...#...#...#.#.#.#...#...#.#.#...#...#.#.#.#.#...#.#...#...#.#...#.....#...# +#.#.#.#.#.#.#v#############.#####.#.#.#####.#.#####.#.#.#####.#.###.#.#####.#.#.#.#######.#.#.#.#######.#.#.#.#.###.#.#####.#.#.###########.# +#.#.#.#.#.#.#.>.#...#...#...#.....#.#...#...#.#...#.#...#.....#...#.#.#.....#.#.#.#.......#.#.#.......#.#.#...#.....#...#...#.#...#.........# +#.#.#.#.#.#.#v#.#.#.#.#.#.###.#####.###.#.###.#.#.#.#####.#######.#.#.#.#####.#.#.#.#######.#.#######.#.#.#############.#.###.###.#.######### +#.#.#.#.#...#.#.#.#.#.#.#...#.....#.#...#...#.#.#.#.....#.#...#...#...#.....#.#.#.#.#...###.#.#...###.#.#.......#.......#...#.....#.#.......# +#.#.#.#.#####.#.#.#.#.#.###.#####.#.#.#####.#.#.#.#####.#.#.#.#.###########.#.#.#.#.#.#.###.#.#.#.###.#.#######.#.#########.#######.#.#####.# +#...#...#.....#.#.#.#.#...#.#.....#.#...###.#.#.#.#.....#...#.#.....#...#...#.#.#.#...#.....#.#.#.#...#.#.....#.#.#...#...#.......#...#.....# +#########.#####.#.#.#.###.#.#.#####.###.###.#.#.#.#.#########.#####.#.#.#.###.#.#.###########.#.#.#.###.#.###.#.#.#.#.#.#.#######.#####.##### +#.........#...#...#...###...#...#...#...#...#.#.#.#.........#.#...#...#.#.###.#.#.#...........#.#.#...#.#...#.#.#.#.#.#.#.#...#...#...#.....# +#.#########.#.#################.#.###.###.###.#.#.#########.#.#.#.#####.#.###.#.#.#.###########.#.###.#.###.#.#.#.#.#.#.#.#.#.#.###.#.#####.# +#.........#.#.#...###...........#...#...#...#.#.#.#.>.>.....#.#.#...#...#.>.>.#.#.#.....#...###.#.#...#...#.#...#.#.#.#.#.#.#.#.#...#...#...# +#########.#.#.#.#.###.#############.###.###.#.#.#.#.#v#######.#.###.#.#####v###.#.#####.#.#.###.#.#.#####.#.#####.#.#.#.#.#.#.#.#.#####.#.### +#.........#.#...#...#.#.....###...#.#...#...#.#.#.#.#.......#...###.#...###...#...#.....#.#...#.#.#.....#.#.#.....#.#.#.#.#.#.#.#.#...#...### +#.#########.#######.#.#.###.###.#.#.#.###.###.#.#.#.#######.#######.###.#####.#####.#####.###.#.#.#####.#.#.#.#####.#.#.#.#.#.#.#.#.#.####### +#...#.....#.#.......#...#...#...#.#.#.>.>.###...#.#...#.....#.......#...#.....#.....#...#...#.#.#.###...#.#.#.#...#.#...#.#.#...#.#.#...#...# +###.#.###.#.#.###########.###.###.#.###v#########.###.#.#####.#######.###.#####.#####.#.###.#.#.#.###.###.#.#.#.#.#.#####.#.#####.#.###.#.#.# +#...#...#...#.#.........#...#...#...###.....#.....#...#.....#.#...#...###.....#...#...#...#.#.#.#.>.>.#...#.#.#.#.#.#.....#.#.....#.#...#.#.# +#.#####.#####.#.#######.###.###.###########.#.#####.#######.#.#.#.#.#########.###.#.#####.#.#.#.###v###.###.#.#.#.#.#.#####.#.#####.#.###.#.# +#...#...#.....#.#.......###...#.#...........#.......#.......#...#.#.#...###...#...#...#...#.#...###...#.....#...#.#.#.....#.#.......#.....#.# +###.#.###.#####.#.###########.#.#.###################.###########.#.#.#.###.###.#####.#.###.#########.###########.#.#####.#.###############.# +#...#.###.......#.......#...#...#.....#...#...#...###...........#.#.#.#.....###...#...#...#.....#.....#...#...###...#...#...###.............# +#.###.#################.#.#.#########.#.#.#.#.#.#.#############.#.#.#.###########.#.#####.#####.#.#####.#.#.#.#######.#.#######.############# +#...#.#...#...#...#.....#.#.###...###...#...#.#.#...............#...#...........#...###...#.....#.#...#.#.#.#...#...#.#.#...#...###.........# +###.#.#.#.#.#.#.#.#.#####.#.###.#.###########.#.###############################.#######.###.#####.#.#.#.#.#.###.#.#.#.#.#.#.#.#####.#######.# +###...#.#.#.#...#...#####.#.#...#.#...#.....#.#.................#...............###...#.....#...#...#...#.#.#...#.#.#.#.#.#.#.......#...#...# +#######.#.#.#############.#.#.###.#.#.#.###.#.#################.#.#################.#.#######.#.#########v#.#.###.#.#.#.#.#.#########.#.#.### +#...#...#.#.....#...###...#.#.#...#.#.#...#...#...#...........#.#.................#.#...#.....#.#...#...>.>.#...#.#.#.#.#.#.###...#...#.#...# +#.#.#.###.#####.#.#.###.###.#.#.###.#.###v#####.#.#.#########.#.#################.#.###.#.#####.#.#.#.###v#####.#.#.#.#.#.#.###v#.#.###.###.# +#.#.#...#.#...#.#.#...#...#.#.#.#...#...>.>.###.#.#.....#...#...#...#.............#...#.#.....#.#.#...###.....#.#.#.#.#...#...>.#...###.....# +#.#.###.#.#.#.#.#.###.###.#.#.#.#.#######v#.###.#.#####.#.#.#####.#.#.###############.#.#####.#.#.###########.#.#.#.#.#########v############# +#.#.#...#.#.#.#...#...###.#...#.#.###...#.#.#...#.#...#...#.#...#.#.#...#.......###...#...#...#.#.#...........#...#.#.#.......#...........### +#.#.#.###.#.#.#####v#####.#####.#.###.#.#.#.#.###.#.#.#####.#.#.#.#.###.#.#####.###.#####.#.###.#.#.###############.#.#.#####.###########.### +#.#.#...#...#.#...#.>...#.....#.#...#.#...#...###.#.#.#.....#.#.#.#.###...#.....#...###...#...#.#.#...#...........#.#.#.....#.....#.....#...# +#.#.###.#####.#.#.#v###.#####.#.###.#.###########.#.#.#.#####.#.#.#.#######.#####.#####.#####.#.#.###.#.#########.#.#.#####.#####.#.###.###.# +#.#.....#...#...#.#...#.#...#.#.#...#.#...#...###...#.#...###.#.#.#.#...###.#...#.....#...#...#...###...#...#.....#...#...#.#...#...###.#...# +#.#######.#.#####.###.#.#.#.#.#.#.###.#.#.#.#.#######.###.###.#.#.#.#.#.###v#.#.#####.###.#.#############.#.#.#########.#.#.#.#.#######.#.### +#.#.....#.#.....#.....#...#...#...###...#...#.#.......#...#...#.#.#.#.#...>.>.#.......###...#...#...#...#.#.#...#.......#.#...#.......#.#...# +#.#.###.#.#####.#############################.#.#######v###.###.#.#.#.#####v#################.#.#.#.#.#.#.#.###.#.#######.###########.#.###.# +#.#.#...#.#...#...............#...............#.#...#.>.>...###...#.#.....#...#.....#.........#.#.#...#...#.....#.#.....#.............#...#.# +#.#.#.###.#.#.###############.#.###############.#.#.#.#v###########.#####.###.#.###.#.#########.#.###############.#.###.#################.#.# +#.#.#...#.#.#...............#.#.#.............#...#.#.#...#...#...#.#...#.#...#.#...#.#.........#...............#...###.....#...#.......#...# +#.#.###.#.#.###############.#.#.#.###########.#####.#.###.#.#.#.#.#.#.#.#.#.###.#.###.#.#######################.###########.#.#.#.#####.##### +#.#.###...#...#...........#.#.#.#.#...........#.....#...#.#.#.#.#.#...#...#...#.#.#...#.........#...............#...........#.#...#...#.....# +#.#.#########.#.#########.#.#.#.#.#.###########.#######.#.#.#.#.#.###########.#.#.#.###########.#.###############.###########.#####.#.#####.# +#...#...#...#...#.........#.#.#.#.#.........###.....#...#.#.#.#.#...#.....###...#...###.........#...#.....###...#.............#.....#.......# +#####.#.#.#.#####.#########.#.#.#.#########.#######.#.###.#.#.#.###.#.###.#############.###########.#.###.###.#.###############.############# +#.....#...#.......#####...#...#...#...#...#.......#.#.#...#.#.#.#...#.#...#...#...#.....###...#...#.#.###...#.#.#...#...#.....#...#.........# +#.#####################.#.#########.#.#.#.#######.#.#.#.###.#.#.#.###.#.###.#.#.#.#.#######.#.#.#.#.#.#####.#.#.#.#.#.#.#.###.###.#.#######.# +#...........#.......#...#.#...###...#...#.........#...#...#.#.#.#.....#...#.#.#.#...#...#...#...#.#...#.....#.#.#.#.#.#.#...#.....#.#.......# +###########.#.#####.#.###.#.#.###.#######################.#.#.#.#########.#.#.#.#####.#.#.#######.#####.#####.#.#.#.#.#.###v#######.#.####### +###...#...#...###...#.#...#.#.#...#...............#.....#...#...###.......#.#.#.......#.#.#.......#...#...###.#.#.#.#.#.#.>.###.....#...#...# +###.#.#.#.#######v###.#.###.#.#.###.#############.#.###.###########v#######.#.#########v#.#.#######.#.###.###.#.#.#.#.#.#.#v###.#######.#.#.# +#...#...#...#...#.>...#.....#.#.#...###...........#...#.....#.....>.>.....#.#.#.......>.>.#.....###.#.#...#...#.#.#.#.#.#.#.#...#.......#.#.# +#.#########.#.#.#v###########.#.#.#####.#############.#####.#.#####v#####.#.#.#.#######v#######.###.#.#.###.###.#.#.#.#.#.#.#.###.#######.#.# +#.....#...#...#...#.....#...#.#...#.....#...#.......#.#...#.#.....#.....#.#.#...###...#.#.....#.#...#.#...#...#.#.#...#.#.#.#.#...#...#...#.# +#####.#.#.#########.###.#.#.#.#####.#####.#.#.#####.#.#.#.#.#####.#####.#.#.#######.#.#.#.###.#.#.###.###.###.#.#.#####.#.#.#.#.###.#.#.###.# +#...#.#.#.........#...#...#...#...#...#...#.#.....#.#...#.#.###...#.....#...#.......#...#...#.#.#...#...#...#.#.#.#...#.#.#...#.....#...#...# +#.#.#.#.#########.###.#########.#.###.#.###.#####.#.#####.#.###.###.#########.#############.#.#.###.###.###.#.#.#.#.#.#.#.###############.### +#.#.#...#...#.....###...###...#.#.###...#...#.....#...#...#.#...###.#.......#...#...###.....#...###...#.#...#.#.#...#.#...#...............### +#.#.#####.#.#.#########.###.#.#.#.#######.###.#######.#.###.#.#####.#.#####.###.#.#.###.#############.#.#v###.#.#####.#####.################# +#.#.#...#.#.#.....#...#...#.#.#.#.#...###...#.......#.#.#...#...#...#.#.....#...#.#...#.#...#...#...#.#.>.>.#.#.......#...#.............##### +#.#.#.#.#.#.#####.#.#.###.#.#.#.#.#.#.#####v#######.#.#.#.#####.#.###.#.#####.###.###.#.#.#.#.#.#.#.#.###v#.#.#########.#.#############.##### +#.#...#...#.....#...#.#...#.#.#.#...#...#.>.>.#.....#...#...#...#...#.#.#...#.....#...#...#.#.#...#.#...#.#...###.....#.#.#...#...#...#.....# +#.#############.#####.#.###.#.#.#######.#.#v#.#.###########.#.#####.#.#.#.#.#######.#######.#.#####.###.#.#######.###.#.#.#.#.#.#.#.#.#####.# +#.............#.......#.....#...#.....#...#.#...###...###...#.#...#...#...#.###...#.#...###.#.#.....#...#...#.....#...#.#...#...#...#.......# +#############.###################.###.#####.#######.#.###.###.#.#.#########.###.#.#.#.#.###.#.#.#####.#####.#.#####.###.##################### +#.........###.......#####.....###...#...###.........#...#.....#.#.........#.#...#.#...#...#.#.#.....#.#.....#.#.....#...#...#...........#...# +#.#######.#########.#####.###.#####.###.###############.#######.#########.#.#.###.#######.#.#.#####.#.#.#####.#.#####.###.#.#.#########.#.#.# +#.......#...#.....#.#.....#...#...#...#.#...#.....#...#.#...#...#...#####...#...#.........#...#...#.#.#...#...#.....#...#.#...#...#...#.#.#.# +#######.###.#.###.#.#.#####.###.#.###.#.#.#.#.###.#.#.#.#.#.#.###.#.###########.###############.#.#.#.###.#.#######.###.#.#####.#.#.#.#.#.#.# +#...###.#...#...#.#.#.....#.#...#.#...#...#...###...#...#.#.#.....#...........#.................#.#...###.#.#.......###...#...#.#.#.#...#.#.# +#.#.###.#.#####.#.#.#####.#.#v###.#.#####################.#.#################.###################.#######.#.#.#############.#.#v#.#.#####.#.# +#.#.....#.#.....#...#...#.#.>.>.#...#...#...#...###...###.#.#...###...........#...................#.....#...#.......#...#...#.>.#...###...#.# +#.#######.#.#########.#.#.###v#.#####.#.#.#.#.#.###.#.###.#.#.#.###v###########.###################.###.###########.#.#.#.#####v#######.###.# +#...#...#...#...#...#.#.#...#.#.......#.#.#.#.#.#...#...#.#...#...>.>.###.......#.....#.....#.....#.#...###...#.....#.#.#.....#.###...#...#.# +###.#.#v#####.#.#.#.#.#.###.#.#########.#.#.#.#.#.#####.#.#########v#.###.#######.###.#.###.#.###.#.#.#####.#.#.#####.#.#####.#.###.#.###.#.# +###...#.>...#.#.#.#.#.#...#.#...#.....#.#.#.#.#.#.#####...#...#...#.#...#.........#...#...#.#...#.#.#...#...#.#.....#.#.###...#.#...#.#...#.# +#######v###.#.#.#.#.#.###.#.###.#.###.#.#.#.#.#.#.#########.#.#.#.#.###.###########.#####.#.###.#.#.###.#.###.#####.#.#.###.###.#.###.#.###.# +#...###...#.#.#.#.#.#.#...#.#...#.#...#...#...#.#.#.........#...#.#...#.....#...#...#...#.#.###.#.#.#...#...#.###...#.#.....###.#.###.#.#...# +#.#.#####.#.#.#.#.#.#.#.###.#.###.#.###########.#.#.#############.###.#####.#.#.#.###.#.#.#.###.#.#.#.#####.#.###v###.#########.#.###.#.#.### +#.#.......#...#.#.#.#.#...#.#...#.#...........#...#...#.........#.#...###...#.#.#...#.#.#.#.#...#.#.#.#...#.#...>.>.#.........#.#.###...#...# +#.#############.#.#.#.###.#.###.#.###########.#######.#.#######.#.#.#####.###.#.###v#.#.#.#.#.###.#.#.#.#.#.#####v#.#########.#.#.#########.# +#.............#...#.#.#...#...#...#...........#.......#.#.......#...#.....#...#...>.>.#...#...#...#.#.#.#.#.#...#.#.....#...#.#.#.#.........# +#############.#####.#.#.#####.#####.###########.#######.#.###########.#####.#######v###########.###.#.#.#.#.#.#.#.#####.#.#.#.#.#.#.######### +###.........#...###.#.#...#...#...#...###...###.........#...........#.#...#.......#.......#...#.#...#.#.#.#.#.#.#.....#.#.#.#.#...#.#.......# +###.#######.###.###.#.###.#.###.#.###.###.#.#######################.#.#.#.#######.#######.#.#.#.#.###.#.#.#.#.#.#####.#.#.#.#.#####.#.#####.# +#...#...###...#...#.#.###.#.#...#...#...#.#...#...#.............#...#.#.#.........#.......#.#.#...###...#...#.#.#...#.#.#.#...#...#...###...# +#.###.#.#####.###.#.#.###.#.#.#####.###.#.###.#.#.#.###########.#.###.#.###########.#######.#.###############.#.#.#.#.#.#.#####.#.#######.### +#.....#.....#.#...#...#...#.#.....#.....#.#...#.#.#.....#.....#.#.###...#...#.....#...#.....#.....###...###...#.#.#.#.#.#...###.#.#...#...### +###########.#.#.#######.###.#####.#######.#.###.#.#####.#.###.#.#.#######.#.#.###.###.#.#########.###.#.###.###.#.#.#.#.###.###.#.#.#.#.##### +###.........#...#...###.....#...#.....#...#...#.#.....#...#...#.#...#.....#.#.#...###...#.........#...#.....###...#...#.....#...#.#.#.#.....# +###.#############.#.#########.#.#####.#.#####.#.#####.#####.###.###.#.#####.#.#.#########.#########.#########################.###.#.#.#####.# +#...#...#.........#...#...#...#.......#.....#...#.....#.....###.....#.....#.#.#...#...#...#.....###.............#...#...#...#...#.#.#.......# +#.###.#.#.###########.#.#.#.###############.#####.#####.#################.#.#.###.#.#.#.###.###.###############.#.#.#.#.#.#.###.#.#.######### +#.....#...#...........#.#.#...#...#.......#.#.....#...#.....###.....#...#.#.#.#...#.#.#.....#...#.....#.........#.#.#.#.#.#...#.#.#.......### +###########.###########.#.###.#.#.#.#####.#.#.#####.#.#####v###.###.#.#.#.#.#.#.###.#.#######.###.###.#.#########.#.#.#.#.###.#.#.#######.### +#...........###...#.....#...#...#...#.....#.#.#...#.#...#.>.>.#.#...#.#.#.#.#.#.###.#.#.......#...#...#.........#.#.#.#.#...#...#.#.....#...# +#.#############.#.#.#######.#########.#####.#.#.#.#.###.#.#v#.#.#.###.#.#.#.#.#.###.#.#v#######.###.###########.#.#.#.#.###.#####.#.###.###.# +#.#.........#...#.#.#.......#.........#...#.#.#.#.#.###...#.#.#.#.#...#.#.#.#.#.#...#.>.>...###...#.#.....#.....#.#.#.#.#...#.....#...#.#...# +#.#.#######.#.###.#.#.#######.#########.#.#.#.#.#.#.#######.#.#.#.#.###.#.#.#.#.#.#####v###.#####.#.#.###.#.#####.#.#.#.#.###.#######.#.#.### +#.#.#.......#...#...#...#...#.........#.#...#...#...#####...#...#...###.#.#.#.#.#.#.....#...#...#.#.#...#...#...#.#.#.#.#.#...###...#.#.#.### +#.#.#.#########.#######.#.#.#########.#.#################.#############.#.#.#.#.#.#.#####.###.#.#.#.###v#####.#.#.#.#.#.#.#.#####.#.#.#.#v### +#...#...#...#...#...#...#.#.#.........#.......#.....#.....#...###.....#...#...#...#...###.#...#.#.#.#.>.>.#...#.#.#.#.#.#.#.#...#.#...#.>.### +#######.#.#.#.###.#.#.###.#.#.###############.#.###.#.#####.#.###.###.###############.###.#.###.#.#.#.#v#.#.###.#.#.#.#.#.#.#.#.#.#######v### +#.......#.#.#...#.#...###.#.#.........#.......#.#...#.#.....#...#...#.#.....#...#####...#.#...#...#.#.#.#...#...#.#.#.#.#.#.#.#...#.....#.### +#.#######.#.###.#.#######.#.#########.#.#######.#.###.#.#######.###.#.#.###.#.#.#######.#.###.#####.#.#.#####.###.#.#.#.#.#.#.#####.###.#.### +#...#...#.#.#...#.......#.#...#...#...#.....#...#...#...#...###.....#.#.#...#.#.#.......#.....#...#.#.#...###...#.#...#...#...#.....###.#...# +###.#.#v#.#.#.#########.#.###.#.#.#.#######.#.#####.#####.#.#########.#.#.###.#.#.#############.#.#.#.###.#####.#.#############.#######.###.# +###...#.>.#.#.#.........#...#.#.#.#...#...#...#...#...#...#.........#...#...#.#.#...............#.#...###...#...#...#.......###...#...#.#...# +#######v###.#.#.###########.#.#.#.###v#.#.#####.#.###.#.###########.#######.#.#.#################.#########.#.#####.#.#####.#####.#.#.#.#.### +###...#...#.#.#.#...#.....#.#.#.#...>.>.#.....#.#.#...#...#.......#.#.......#.#...###...#.......#.#.........#...#...#.#...#.......#.#.#...### +###.#.###.#.#.#.#.#.#.###.#.#.#.#####v#######.#.#.#.#####.#.#####.#.#.#######.###.###.#.#.#####.#.#.###########.#.###.#.#.#########.#.####### +#...#.....#.#.#.#.#.#.###.#.#...###...#...###...#...#.....#.#.....#.#.#...#...#...#...#.#...###...#...........#...###...#...#.......#.....### +#.#########.#.#.#.#.#.###.#.#######.###.#.###########.#####.#.#####.#.#.#.#.###.###.###.###.#################.#############.#.###########.### +#.#...#...#...#.#.#...###...###...#.....#...........#...#...#.....#...#.#.#...#.....###.....#.......#...#...#.#.......#####.#.#.........#...# +#.#.#.#.#.#####.#.#############.#.#################.###.#.#######.#####.#.###.###############.#####.#.#.#.#.#.#.#####.#####.#.#.#######.###.# +#...#.#.#.#...#.#.....###.......#.....#...#...#.....#...#...#...#.......#.#...#.............#.....#.#.#...#.#.#.#...#.#.....#.#.......#.#...# +#####.#.#.#.#.#.#####.###.###########.#.#.#.#.#.#####.#####.#.#.#########.#.###.###########.#####.#.#.#####.#.#.#.#.#.#.#####.#######.#.#.### +#...#...#...#.#.#.....#...#...#...###...#...#.#...###.......#.#...........#.....#.....#.....#...#.#.#.....#...#.#.#...#.......###.....#...### +#.#.#########.#.#.#####.###.#.#.#.###########.###.###########.###################.###.#.#####.#.#.#.#####v#####.#.###############.########### +#.#...........#...#...#.#...#...#...#...#...#.....#...###...#.............###...#...#...#...#.#.#.#...#.>.>.#...#.......#.........#...#...### +#.#################.#.#.#.#########.#.#.#.#.#######.#.###.#.#############.###.#.###v#####.#.#.#.#.###.#.###.#.#########.#.#########.#.#.#.### +#.........#.....#...#.#.#.#.........#.#...#.......#.#.#...#.....#.........#...#.#.>.>.#...#.#.#.#...#.#.#...#.#.........#...........#...#...# +#########.#.###.#.###.#.#.#.#########.###########.#.#.#.#######.#.#########.###.#.###.#.###.#.#.###.#.#.#.###.#.###########################.# +#.........#.#...#.#...#...#...#...###.#...#.......#.#.#...#...#...###...#...###.#.#...#...#...#.#...#...#.....#...#.....#.............#...#.# +#.#########.#.###.#.#########.#.#.###.#.#.#.#######.#.###.#.#.#######.#.#.#####.#.#.#####.#####.#.###############.#.###.#.###########.#.#.#.# +#.........#.#.#...#...###...#...#...#...#.#...#...#.#...#...#.....#...#.#.....#...#...#...###...#.......#.........#.#...#...........#.#.#...# +#########.#.#.#.#####.###.#.#######.#####.###.#.#.#.###.#########.#.###.#####.#######.#.#####.#########.#.#########.#.#############.#.#.##### +###.......#.#.#.#...#...#.#...#.....#...#...#.#.#.#.#...###...###.#.#...#...#...#.....#.....#.#.....#...#.........#.#...#...#...#...#...#...# +###.#######.#.#.#.#.###.#.###.#.#####.#.###.#.#.#.#.#.#####.#.###v#.#.###.#.###.#.#########.#.#.###.#.###########.#.###.#.#.#.#.#v#######.#.# +#...#.....#.#.#...#.###.#.#...#...#...#...#.#.#.#.#.#...#...#.#.>.>.#...#.#...#.#...#...#...#.#...#...###.........#.###.#.#.#.#.>.###...#.#.# +#.###.###.#.#.#####.###.#.#.#####v#.#####.#.#.#.#.#.###.#.###.#.#######.#.###.#.###.#.#.#.###.###.#######.#########.###.#.#.#.###v###.#.#.#.# +#.#...###.#.#.......#...#.#...#.>.>.#.....#.#.#.#.#.#...#...#.#.......#.#...#.#.#...#.#.#...#...#.......#.#.......#.#...#.#...#...#...#.#.#.# +#.#.#####.#.#########.###.###.#.#####.#####.#.#.#.#.#.#####.#.#######.#.###.#.#.#.###.#.###.###.#######.#.#.#####.#.#.###.#####.###.###.#.#.# +#.#.....#.#.#.........#...#...#...#...#...#.#.#.#.#.#...#...#.#...#...#.#...#.#.#.#...#.#...#...#...#...#.#.#.....#.#...#.....#...#.#...#.#.# +#.#####.#.#.#.#########.###.#####.#.###.#.#.#.#.#.#.###.#.###.#.#.#.###.#.###.#.#.#.###.#.###.###.#.#.###.#.#.#####.###.#####.###.#.#.###.#.# +#.......#...#...........###.......#.....#...#...#...###...###...#...###...###...#...###...###.....#...###...#.......###.......###...#.....#.# +###########################################################################################################################################.# diff --git a/run b/run index f9d7e67..ff422e7 100755 --- a/run +++ b/run @@ -15,7 +15,7 @@ set day $argv[1] set part $argv[2] if test -n $input - scala-cli run **.scala --main-class "aoc.day$day.Day$day" -- $part $argv[3..] < ./inputs/day$day.input + scala-cli run -J "-Xss1024m" **.scala --main-class "aoc.day$day.Day$day" -- $part $argv[3..] < ./inputs/day$day.input else - scala-cli run **.scala --main-class "aoc.day$day.Day$day" -- $part $argv[3..] + scala-cli run -J "-Xss1024m" **.scala --main-class "aoc.day$day.Day$day" -- $part $argv[3..] end