From b053e244e43a37c9ceb0b5d50927f63664025d39 Mon Sep 17 00:00:00 2001 From: Stefan Harmuth Date: Mon, 25 Dec 2023 15:47:53 +0100 Subject: [PATCH] Day 22 - make use of new progress bar feature --- day22.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/day22.py b/day22.py index 16ff6e3..04e4693 100644 --- a/day22.py +++ b/day22.py @@ -59,11 +59,21 @@ class Day(AOCDay): def part1(self) -> Any: 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: 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__":