Exemple #1
0
def main():
    aoc.header("Amplification Circuit")
    aoc.run_tests()

    program = list(map(int, aoc.get_input().readline().split(",")))
    aoc.output(1, part1, args=[program])
    aoc.output(2, part2, args=[program])
Exemple #2
0
def main():
    aoc.header("1202 Program Alarm")
    aoc.run_tests()

    aoc.output(1, part1)
    aoc.output(2, part2, comment="Nested loop")
    aoc.output(2, part2_mp, comment="Multiprocessing")
Exemple #3
0
def main():
    aoc.header("Sunny with a Chance of Asteroids")
    aoc.run_tests()

    test_program = list(map(int, aoc.get_input().readline().split(",")))
    aoc.output(1, run, args=[test_program, [1], INSTRUCTIONS_P1])
    aoc.output(2, run, args=[test_program, [5], INSTRUCTIONS_P2])
Exemple #4
0
def main():
    aoc.header("Secure Container")
    aoc.run_tests()

    (lower, upper) = aoc.get_input().readline().split("-")
    aoc.output(1, part, args=[int(lower), int(upper), validate_p1])
    aoc.output(2, part, args=[int(lower), int(upper), validate_p2])
Exemple #5
0
def main():
    aoc.header("Sensor Boost")
    aoc.run_tests()

    program = list(map(int,aoc.get_input().readline().split(",")))
    aoc.output(1, part, args=[program, [1]])
    aoc.output(2, part, args=[program, [2]])
Exemple #6
0
def main():
    aoc.header("Universal Orbit Map")
    aoc.run_tests()

    orbits = aoc.get_input().readlines()
    output = aoc.output(1, part1, args=[orbits], post=itemgetter(0))
    aoc.output(2, part2_graph, args=[orbits, *output[1:]], comment="Dijstra's algorithm")
    aoc.output(2, part2_ancestor, args=[orbits, *output[1:]], comment="Common ancestor")
Exemple #7
0
def main():
    aoc.header("Space Image Format")
    aoc.run_tests()

    data = aoc.get_input().readline().strip()

    s = Size(width=25, height=6)
    (_, layers) = aoc.output(1, part1, args=[data, s], post=itemgetter(0))
    aoc.output(2, part2, args=[layers, s], post=lambda i: (i, s), output=lambda t: print_image4(t[0], t[1]))
Exemple #8
0
def main():
    aoc.header("Crossed Wires")
    aoc.run_tests()

    inp = aoc.get_input()
    path_a = list(inp.readline().split(","))
    path_b = list(inp.readline().split(","))
    aoc.output(1, part1, args=[path_a, path_b])
    aoc.output(2, part2, args=[path_a, path_b])
Exemple #9
0
def main():
    aoc.header("Space Police")

    program = list(map(int, aoc.get_input().readline().split(",")))
    aoc.output(1, run_robot, args=[program, False], post=lambda t: len(t[1]))
    aoc.output(2, run_robot, args=[program, True], output=part2_post)
Exemple #10
0
def main():
    aoc.header("Monitoring Station")
    aoc.run_tests()

    (asteroids, edge, station, _) = aoc.output(1, part1, post=itemgetter(3))
    aoc.output(2, part2, args=[asteroids, edge, station])
Exemple #11
0
def main():
    aoc.header("The Tyranny of the Rocket Equation")
    aoc.run_tests()

    aoc.output(1, part1)
    aoc.output(2, part2)
Exemple #12
0
def main():
    aoc.header("The N-Body Problem")
    aoc.run_tests()

    aoc.output(1, part1)