Skip to content

Commit b43b7d9

Browse files
committed
Move Node implementation into shortestProgram
1 parent e8d3bcf commit b43b7d9

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

day21/src/day21.scala

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -76,11 +76,11 @@ case class State(pads: List[Pad] = List(), output: String = "") {
7676
State(newPads, newOutput)
7777
}
7878

79-
case class Node(state: State = State(), program: String = "") extends Ordered[Node] {
80-
def compare(that: Node): Int = that.program.length compare program.length // Intentionally reversed for min-heap
81-
}
82-
8379
def shortestProgram(startState: State, goal: String): String =
80+
case class Node(state: State = State(), program: String = "") extends Ordered[Node] {
81+
def compare(that: Node): Int = that.program.length compare program.length // Intentionally reversed for min-heap
82+
}
83+
8484
// Your run-of-the-mill Dijkstra implementation
8585

8686
val queue = mutable.PriorityQueue[Node]()

0 commit comments

Comments
 (0)