Exemplo n.º 1
0
def run() -> tuple(Solution, Solution):
    data: Dataset = day(15, lambda row: list(map(int, list(row))))
    m = Map(data, 5)
    return (
        Map(data).shortest_path(),
        Map(data, 5).shortest_path(),
    )
Exemplo n.º 2
0
def run() -> tuple(Solution, Solution):
    data: Dataset = day(13)
    points, folds = parse_data(data)
    return (
        len(fold_all(points, folds, 1)),
        print_code(fold_all(points, folds)),
    )
Exemplo n.º 3
0
def run() -> tuple(Solution, Solution):
    data: Dataset = day(14)
    formula, rules = parse_data(data)
    return (Reaction(formula,
                     rules).step(10).count(), Reaction(formula,
                                                       rules).step(40).count())
Exemplo n.º 4
0
def run() -> tuple(Solution, Solution):
    data: Dataset = day(16)
    packet = PacketParser.parse_hex(data)
    return (packet.version_sum(), packet.eval())
Exemplo n.º 5
0
def run() -> tuple(Solution, Solution):
    data = day(5, lambda line: Line(*parse_numbers(line)))
    return (max_overlapping_lines(filter(Line.is_horizontal,
                                         data)), max_overlapping_lines(data))
Exemplo n.º 6
0
def run() -> tuple(Solution, Solution):
    data: Dataset = day(11, lambda line: list(map(int, list(line))))
    return (
        FlashingMatrix(data).run(100),
        FlashingMatrix(data).find_first_synchronized()
    )
Exemplo n.º 7
0
def run() -> tuple(Solution, Solution):
    data = day(2)
    return (
        final_position(data, position_class=Position),
        final_position(data, position_class=AimPosition)
    )
Exemplo n.º 8
0
def run():
    data = day(1, apply=int)
    return (
        find_increasing(data),
        find_increasing_triples(data)
    )
Exemplo n.º 9
0
def run() -> tuple(Solution, Solution):
    data = day(6, parse_numbers)
    return (len(Aquarium(data[0]).next_day(80)),
            len(Aquarium(data[0]).next_day(256)))
Exemplo n.º 10
0
def run() -> tuple(Solution, Solution):
    data = day(3)
    return (power_consumption(data), LifeSupportRating(data).value)
Exemplo n.º 11
0
def run() -> tuple(Solution, Solution):
    data: Dataset = day(17, parse_target)
    hits = list(all_hits(data))
    return (max(hits), len(hits))
Exemplo n.º 12
0
def run() -> tuple(Solution, Solution):
    data = day(10)
    return (
        corrupted_score(data),
        autocomplete_score(data)
    )
Exemplo n.º 13
0
def run() -> tuple(Solution, Solution):
    data: Dataset = day(9, lambda line: list(map(int, list(line))))
    hm = HeatMap(data)
    print(hm)
    return (hm.risk_factor(), hm.three_biggest_basins())
Exemplo n.º 14
0
def run() -> tuple(Solution, Solution):
    data = day(4, parse_numbers)
    numbers, boards = parse_data(data)
    return (first_winning_score(boards,
                                numbers), last_winning_score(boards, numbers))
Exemplo n.º 15
0
def run() -> tuple(Solution, Solution):
    data: Dataset = day(12, lambda line: line.split('-'))
    caves = Graph(data)
    return (caves.number_of_paths(),
            caves.number_of_paths(with_second_visit=True))