def test_is_board_winner_with_winning_column(raw_data: list[str]): bingo = puzzle_input_to_bingo(raw_data) bingo.boards[0][3] = -1 bingo.boards[0][8] = -1 bingo.boards[0][13] = -1 bingo.boards[0][18] = -1 bingo.boards[0][23] = -1 assert is_board_winner(bingo.boards[0]) is True
def giant_squid2() -> int: puzzle_input = puzzle_input_to_str(4, strip=True) bingo = puzzle_input_to_bingo(puzzle_input) return last_winning_board(bingo)
def test_last_winning_board(raw_data: list[str]): bingo = puzzle_input_to_bingo(raw_data) assert last_winning_board(bingo) == 1924
def test_first_winning_board(raw_data: list[str]): bingo = puzzle_input_to_bingo(raw_data) assert first_winning_board(bingo) == 4512
def test_is_board_winner_with_winning_row(raw_data: list[str]): bingo = puzzle_input_to_bingo(raw_data) for i in range(5): bingo.boards[0][i] = -1 assert is_board_winner(bingo.boards[0]) is True
def test_is_board_winner_no_marked_numbers(raw_data: list[str]): bingo = puzzle_input_to_bingo(raw_data) assert is_board_winner(bingo.boards[0]) is False
def test_puzzle_input_to_bingo(raw_data: list[str]): bingo = puzzle_input_to_bingo(raw_data) assert bingo.moves[0] == 7 and bingo.moves[-1] == 1 assert len(bingo.boards) == 3