Exemplo n.º 1
0
def main():
    if part_one():
        result = p1()
        print(f"Result: {result}")

    if part_two():
        result = p2()
        print(f"Result: {result}")
Exemplo n.º 2
0
def main():
    result, maxp = p1()
    if part_one():
        print(f'Result: {result}')
        print(maxp)

    if part_two():
        result = p2(maxp)
        print(f'Result: {result}')
Exemplo n.º 3
0
def main():
    if part_one():
        result = p1()
        print(f'Result: {result}')

    if part_two():
        result = p2()
        print(f'Result: {result}')

    if aoc.draw():
        import curses
        curses.endwin()
Exemplo n.º 4
0
    def opcode_none(self, x):
        return x

    def process(self, verb, noun):
        self.output = []
        self.lst = self.olst.copy()
        self._processing = True
        index = 0
        while self._processing:
            index = getattr(self, self.opcodes[self.lst[index] % 100])(index)
        return self.lst[0]

    def process_till(self, result):
        for i in range(0, len(self.olst)):
            for j in range(0, len(self.olst)):
                res = p.process(i, j)
                if res == result:
                    return 100 * i + j


if part_one():
    p = processor(inp, 1)
    result = p.process(12, 2)
    print(p.output)

if part_two():
    p = processor(inp, 5)
    result = p.process(1, 19690720)
    print(p.output)