From b9d32629c8dac73f0df34657310486b0622ed1f3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Anders=20Engl=C3=B6f=20Ytterstr=C3=B6m?= Date: Sun, 21 Jan 2024 13:48:34 +0100 Subject: [PATCH] Solve 2019:13 pt1 --- 2019-python/output/day_13.py | 37 ++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 2019-python/output/day_13.py diff --git a/2019-python/output/day_13.py b/2019-python/output/day_13.py new file mode 100644 index 0000000..3d8ac3f --- /dev/null +++ b/2019-python/output/day_13.py @@ -0,0 +1,37 @@ +from output import answer +from output.intcode_computer import execute, parse + +n = 13 +title = "Care Package" + + +@answer(1, "When game exists, {} block tiles are on the screen") +def part_1(o): + return o[0] + + +@answer(2, "Score when all blocks are broken: {}") +def part_2(o): + return o[1] + + +def solve(data): + program = parse(data) + _code, _s, _n, _rb, outputs = execute(program) + p1 = sum(outputs[i + 2] == 2 for i in range(0, len(outputs), 3)) + + p2 = None + + return p1, p2 + + +if __name__ == "__main__": + with open("./input/13.txt", "r") as f: + inp = f.read().strip() + + inp = solve(inp) + + a = part_1(inp) + # b = part_2(inp) + + assert a == 355