Example #1
0
def all_days():
    timer = Advent_Timer()
    for day in menu_options:
        print("Day {}, part 1".format(day))
        menu_options[day].part1("data/day{}.dat".format(day))
        timer.checkpoint_hit()
        print("Day {}, part 2".format(day))
        menu_options[day].part2("data/day{}.dat".format(day))
        timer.checkpoint_hit()
    timer.end_hit()
Example #2
0
    memory = {}
    for key, val in data:
        if key == "mask":
            mask = val
            continue
        indices = apply_mask_2(mask, int(key[4:-1]))
        for index in indices:
            memory[index] = int(val)
    return sum(memory.values())


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

    # parse input
    data = read_input()
    print("Input parsed!")
    timer.checkpoint_hit()

    # star 1
    star_1_answer = star_1(data)
    print("Star 1: {}".format(star_1_answer))
    timer.checkpoint_hit()

    # star 2
    star_2_answer = star_2(data)
    print("Star 1: {}".format(star_2_answer))
    timer.checkpoint_hit()

    timer.end_hit()