Exemple #1
0
def read_bus_input() -> tuple:
    raw_input = read_input(day=13)

    earliest_bus = int(raw_input[0])
    buses = [Bus(b) for b in raw_input[1].split(',')]

    return earliest_bus, buses
Exemple #2
0
def read_terrain_input() -> List[List[str]]:
    input = read_input(3)
    terrain_input = []

    for row in input:
        terrain_input.append([i for i in row])

    return terrain_input
Exemple #3
0
def read_code_input() -> list:
    raw_input = read_input(day=8)
    instructions = []

    for i, input in enumerate(raw_input):
        command, param_str = input.split(' ')
        instructions.append(Instruction(i, command, int(param_str)))

    return instructions
Exemple #4
0
def read_customs_answer_input() -> List[GroupAnswer]:
    raw_input = read_input(6)
    groups = []
    group = ""

    for individual in raw_input:
        space = " " if group else ""
        if individual:
            group += f"{space}{individual}"
        else:
            groups.append(group)
            group = ""
    groups.append(group)

    return [GroupAnswer(g) for g in groups]
Exemple #5
0
def read_passport_input() -> List[str]:
    input = read_input(4)

    passport_inputs = []
    passport_info = ""

    for i in input:
        if i:
            space = " " if passport_info else ""
            passport_info += f"{space}{i}"
        else:
            passport_inputs.append(passport_info)
            passport_info = ""

    passport_inputs.append(passport_info)

    return passport_inputs
Exemple #6
0
def read_boarding_pass_input() -> List[BoardingPass]:
    raw_input = read_input(day=5)

    return [BoardingPass(i) for i in raw_input]
Exemple #7
0
def read_expense_input() -> list:
    return sorted([int(i) for i in read_input(1)])
Exemple #8
0
def read_xmas_input() -> List[int]:
    raw_input = read_input(day=9)
    return [int(i) for i in raw_input]
Exemple #9
0
def read_seat_input() -> list:
    raw_input = read_input(day=11)
    grid = [[Seat(s) for s in row] for row in raw_input]

    return grid
Exemple #10
0
def read_bag_input() -> BaggageRules:
    raw_input = read_input(day=7)

    return BaggageRules(raw_input)
Exemple #11
0
def read_password_input(rule_type: TypeVar) -> List[Password]:
    puzzle_input = read_input(2)
    return [Password(i, rule_type) for i in puzzle_input]
Exemple #12
0
def read_navigation_instructions() -> List[Instruction]:
    input = read_input(day=12)

    return [Instruction(i) for i in input]
Exemple #13
0
def read_sorted_joltage_input() -> List[int]:
    raw_input = read_input(day=10)
    return sorted([int(i) for i in raw_input])