Skip to content

Commit 22f6475

Browse files
committed
clean up fillMemory
1 parent 4ae98ee commit 22f6475

File tree

1 file changed

+5
-7
lines changed
  • src/main/kotlin/me/peckb/aoc/_2024/calendar/day09

1 file changed

+5
-7
lines changed

src/main/kotlin/me/peckb/aoc/_2024/calendar/day09/Day09.kt

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,11 @@ class Day09 @Inject constructor(
3030

3131
line.forEach { char ->
3232
val length = char.digitToInt()
33-
if (file) {
34-
memory.add(Space.Full(length, File(id++)))
35-
file = false
36-
} else {
37-
memory.add(Space.Empty(length))
38-
file = true
39-
}
33+
34+
if (file) { memory.add(Space.Full(length, File(id++))) }
35+
else { memory.add(Space.Empty(length)) }
36+
37+
file = !file
4038
}
4139

4240
return memory

0 commit comments

Comments
 (0)