Day 22 - make use of new progress bar feature

This commit is contained in:
Stefan Harmuth 2023-12-25 15:47:53 +01:00
parent 67a278ce0c
commit b053e244e4

View File

@ -59,11 +59,21 @@ class Day(AOCDay):
def part1(self) -> Any: def part1(self) -> Any:
dropped_bricks, _ = drop(self.parse_input()) dropped_bricks, _ = drop(self.parse_input())
return sum(c[1] == 0 for c in (drop(dropped_bricks - {x}) for x in dropped_bricks)) count = 0
for brick in dropped_bricks:
_, c = drop(dropped_bricks - {brick})
count += c == 0
self.progress(len(dropped_bricks))
return count
def part2(self) -> Any: def part2(self) -> Any:
dropped_bricks, _ = drop(self.parse_input()) dropped_bricks, _ = drop(self.parse_input())
return sum(c[1] for c in (drop(dropped_bricks - {x}) for x in dropped_bricks)) count = 0
for brick in dropped_bricks:
_, c = drop(dropped_bricks - {brick})
count += c
self.progress(len(dropped_bricks))
return count
if __name__ == "__main__": if __name__ == "__main__":