This commit is contained in:
Sijmen 2024-01-03 21:53:04 +01:00
parent 4d5c4e86c6
commit 9e7415833c
Signed by: vijfhoek
GPG key ID: DAF7821E067D9C48

View file

@ -1,4 +1,3 @@
from pprint import pprint
import sys import sys
def part1(workflows: dict[str, list[list[str]]], ratings: str) -> int: def part1(workflows: dict[str, list[list[str]]], ratings: str) -> int:
@ -10,7 +9,6 @@ def part1(workflows: dict[str, list[list[str]]], ratings: str) -> int:
workflow = "in" workflow = "in"
while workflow not in "RA": while workflow not in "RA":
print(workflow)
for rule in workflows[workflow]: for rule in workflows[workflow]:
match rule: match rule:
case [target]: case [target]:
@ -34,7 +32,6 @@ def part2(workflows: dict[str, list[list[str]]]) -> int:
(workflow, x, m, a, s) = stack.pop() (workflow, x, m, a, s) = stack.pop()
if workflow == "A": if workflow == "A":
print(x, m, a, s)
result += (x[1] - x[0]) * (m[1] - m[0]) * (a[1] - a[0]) * (s[1] - s[0]) result += (x[1] - x[0]) * (m[1] - m[0]) * (a[1] - a[0]) * (s[1] - s[0])
continue continue