Beispiel #1
0
def part_01(input_path):
    """Part 1"""
    with open(input_path) as file_input:
        codes = read_codes(file_input)

    total = alignment_parameter(codes)
    print(total)
Beispiel #2
0
def part_01(input_path):
    """Part 1"""
    with open(input_path) as file_input:
        codes = read_codes(file_input)

    total = tractor_beam(codes, 49, 49)
    print(total)
Beispiel #3
0
def part_02(input_path, debug):
    """Part 2"""
    with open(input_path) as file_input:
        codes = read_codes(file_input)

    if debug:
        total = hull_damage(codes)
    else:
        # tile 1, 2, or 3 is a hole and 4 is not
        # and tile 5 or 8 is not
        inputs = list(
            "NOT A T\n"
            "OR T J\n"
            "NOT B T\n"
            "OR T J\n"
            "NOT C T\n"
            "OR T J\n"
            "AND D J\n"
            "AND E T\n"
            "OR H T\n"
            "AND T J\n"
            "RUN\n")
        total = hull_damage(codes, inputs)

    print(total)
def part_01(input_path, debug):
    """Part 1"""
    with open(input_path) as file_input:
        codes = read_codes(file_input)

    if debug:
        total = hull_damage(codes)
    else:
        inputs = list("NOT C J\n"
                      "AND D J\n"
                      "NOT A T\n"
                      "OR T J\n"
                      "WALK\n")
        total = hull_damage(codes, inputs)

    print(total)