diff options
Diffstat (limited to '2_2022.py')
-rw-r--r-- | 2_2022.py | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/2_2022.py b/2_2022.py new file mode 100644 index 0000000..a62194d --- /dev/null +++ b/2_2022.py @@ -0,0 +1,33 @@ +i = [l.strip() for l in open("2_2022.txt")] +p1 = 0 +p2 = 0 +for x in i: + op, me = x.split() + p1 += {"X": 1, "Y": 2, "Z": 3}[me] + p1 += { + ("A", "X"): 3, + ("A", "Y"): 6, + ("A", "Z"): 0, + ("B", "X"): 0, + ("B", "Y"): 3, + ("B", "Z"): 6, + ("C", "X"): 6, + ("C", "Y"): 0, + ("C", "Z"): 3, + }[(op, me)] + + p2 += {"X": 0, "Y": 3, "Z": 6}[me] + p2 += { + ("A", "X"): 3, + ("A", "Y"): 1, + ("A", "Z"): 2, + ("B", "X"): 1, + ("B", "Y"): 2, + ("B", "Z"): 3, + ("C", "X"): 2, + ("C", "Y"): 3, + ("C", "Z"): 1, + }[(op, me)] + +print(p1) +print(p2) |