Beispiel #1
0
def all_days():
    timer = Advent_Timer()
    for day in menu_options:
        menu_options[day].part1("../data/day{}.dat".format(day))
        timer.checkpoint_hit()
        menu_options[day].part2("../data/day{}.dat".format(day))
        timer.checkpoint_hit()
    timer.end_hit()
Beispiel #2
0
            self.prev_num = i - 1 - turns
        return self.prev_num


def part1(filename):
    data = readfile(filename)
    game = memory_game(data)
    final_num = game.evolve_till(2020)
    print("Final number spoken is {}.".format(final_num))


def part2(filename):
    data = readfile(filename)
    game = memory_game(data)
    final_num = game.evolve_till(30000000)
    print("Final number spoken is {}.".format(final_num))


if __name__ == "__main__":
    timer = Advent_Timer()

    print("Part 1:")
    part1("../../data/day15.dat")
    timer.checkpoint_hit()

    print("\nPart 2:")
    part2("../../data/day15.dat")
    timer.checkpoint_hit()

    timer.end_hit()