Skip to content

Commit b87fc5b

Browse files
committed
Day 6: part 1 cleanup
1 parent 8dcfec8 commit b87fc5b

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/main/scala/Day06.scala

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -115,10 +115,10 @@ object Day06:
115115

116116
def parse(rows: List[String]): Option[Lab] = for {
117117
cells <- rows.traverse(_.toList.traverse(Cell.parse))
118-
(guardPos, direction) <- findGuard(cells)
119-
} yield Lab(cells, Guard(guardPos, direction))
118+
guard <- findGuard(cells)
119+
} yield Lab(cells, guard)
120120

121-
def findGuard(cells: List[List[Cell]]): Option[(Pos, Direction)] =
121+
def findGuard(cells: List[List[Cell]]): Option[Guard] =
122122
cells.zipWithIndex
123123
.map((row, rowIndex) => row.zipWithIndex.map((cell, colIndex) => (Pos(rowIndex, colIndex), cell)))
124-
.collectFirstSome(_.collectFirst { case (pos, GuardCell(direction)) => (pos, direction) })
124+
.collectFirstSome(_.collectFirst { case (pos, GuardCell(direction)) => Guard(pos, direction) })

0 commit comments

Comments
 (0)