Example #1
0
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
Example #2
0
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)
Example #3
0
def test_last_winning_board(raw_data: list[str]):
    bingo = puzzle_input_to_bingo(raw_data)
    assert last_winning_board(bingo) == 1924
Example #4
0
def test_first_winning_board(raw_data: list[str]):
    bingo = puzzle_input_to_bingo(raw_data)
    assert first_winning_board(bingo) == 4512
Example #5
0
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
Example #6
0
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
Example #7
0
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