Пример #1
0
def main():
    x = IO.read_image('../data/input.txt')

    t0 = time.time()
    part_one, spot_index = compute_vision(x)
    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()
    part_two = blast(x, spot_index, n_asteriods=200)
    time_part_two = round((time.time() - t0) * 1e3)
    print("Solution to part two: %s (time taken %s[ms])" %
          (part_two, time_part_two))
Пример #2
0
def main():

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

    x = IO.read_image(file_location)

    t0 = time.time()
    part_one, spot_index = compute_vision(x)
    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()
    part_two = blast(x, spot_index, n_asteriods=200)
    time_part_two = round((time.time() - t0) * 1e3)
    print("Solution to part two: %s (time taken %s[ms])" %
          (part_two, time_part_two))
Пример #3
0
 def __init__(self, file_location, image_width, image_height):
     """Constructor: read image and specify dimensinons."""
     self.img = IO.read_image(file_location, image_width, image_height)
     self.wide, self.tall = image_width, image_height