advent-of-code

advent of code (partial solutions)
Log | Files | Refs | README

commit 2db81fa57fe03d9d20482bb2d3a2e748373eb88b
parent 4b1085f718dd91c4fa5f4cbacef5dcb160941df9
Author: alex wennerberg <alex@alexwennerberg.com>
Date:   Fri,  3 Dec 2021 21:56:55 -0800

Cleanup day 4 input

Diffstat:
M2021/aoc04.py | 9++++-----
1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/2021/aoc04.py b/2021/aoc04.py @@ -36,16 +36,15 @@ def print_cards(): print(line) print("") +wins = 0 for n in nums: - print(n) for card in cards: mark_value(n, card, -1) if check_win(card): - print("WIN") mark_value(-1, card, 0) - print(sum(map(sum, card)) * n) + if wins == 0 or wins == len(cards) -1 : + print(sum(map(sum, card)) * n) + wins += 1 for i in range(5): card[i][i] = -2 # invalidate card - if n == 13: - print_cards()