Skip to content

Commit

Permalink
🎨 cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
twentylemon committed Dec 17, 2024
1 parent 0df2b0f commit bd34986
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/main/scala/org/lemon/advent/year2024/Day17.scala
Original file line number Diff line number Diff line change
Expand Up @@ -99,9 +99,9 @@ private object Day17:

// the program output depends on the length of A in octal
// assumption is that the most significant tribit of A relates to the last output
program.tails.toSeq.reverse.drop(1).foldLeft(Seq(0L)) { (acc, tail) =>
program.reverse.foldLeft(Seq(0L)) { (acc, ele) =>
acc.flatMap(a =>
(a * 8 until (a + 1) * 8).filter(a => execute(initialState(a, b, c, program)).output == tail)
(a * 8 until (a + 1) * 8).filter(a => execute(initialState(a, b, c, program)).output.head == ele)
)
}
.min

0 comments on commit bd34986

Please sign in to comment.