Skip to content

Commit 33cf1c2

Browse files
committed
Fix typos
1 parent 753344f commit 33cf1c2

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

day21/src/day21.scala

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ val PAD_LAYOUTS = Map(
1818
(PadType.Num, Map(
1919
(Vec2(0, 0), '1'), (Vec2(1, 0), '2'), (Vec2(2, 0), '3'),
2020
(Vec2(0, 1), '4'), (Vec2(1, 1), '5'), (Vec2(2, 1), '6'),
21-
(Vec2(0, 2), '7'), (Vec2(1, 2), '7'), (Vec2(2, 2), '8'),
22-
(Vec2(1, 3), '9'), (Vec2(2, 3), 'A'),
21+
(Vec2(0, 2), '7'), (Vec2(1, 2), '8'), (Vec2(2, 2), '9'),
22+
(Vec2(1, 3), '0'), (Vec2(2, 3), 'A'),
2323
)),
2424
(PadType.Dir, Map(
2525
(Vec2(1, 0), '^'), (Vec2(2, 0), 'A'),
@@ -73,7 +73,7 @@ case class State(pads: List[Pad] = List(), output: String = "") {
7373
}
7474

7575
case class Node(state: State = State(), program: String = "") extends Ordered[Node] {
76-
def compare(that: Node): Int = program.length() compare that.program.length()
76+
def compare(that: Node): Int = that.program.length() compare program.length() // Intentionally reversed for min-heap
7777
}
7878

7979
def shortestProgram(startState: State, goal: String): String =
@@ -88,7 +88,6 @@ def shortestProgram(startState: State, goal: String): String =
8888

8989
while !queue.isEmpty do
9090
val node = queue.dequeue()
91-
println(node)
9291
if node.state.output == goal then
9392
return node.program
9493

0 commit comments

Comments
 (0)