Ejemplo n.º 1
0
def main():

    # Part one
    t0 = time.time()
    # Get dependency formula
    formula = IO.readFile("../data/input.txt")
    part_one = compute(formula, 'ORE', 1)
    time_part_one = round((time.time() - t0) * 1e3)
    print("Solution to part one: %s (time taken %s[ms])" %
          (part_one, time_part_one))

    t0 = time.time()
    formula = IO.readFile("../data/input.txt")
    part_two = compute_fuel(formula)
    time_part_two = round((time.time() - t0) * 1e3)
    print("Solution to part two: %s (time taken %s[ms])" %
          (part_two, time_part_two))
Ejemplo n.º 2
0
def main():

    dir_path = dirname(realpath(__file__))
    file_location = join(dir_path, "../data/test_input0.txt")

    # Part one
    t0 = time.time()
    # Get dependency formula
    formula = IO.readFile(file_location)
    part_one = compute(formula, "ORE", 1)
    time_part_one = round((time.time() - t0) * 1e3)
    print(
        "Solution to part one: %s (time taken %s[ms])"
        % (part_one, time_part_one)
    )

    t0 = time.time()
    formula = IO.readFile(file_location)
    part_two = compute_fuel(formula)
    time_part_two = round((time.time() - t0) * 1e3)
    print(
        "Solution to part two: %s (time taken %s[ms])"
        % (part_two, time_part_two)
    )