diff options
author | boredpasta <boredpasta@tutanota.com> | 2025-01-13 07:00:52 +0200 |
---|---|---|
committer | boredpasta <boredpasta@tutanota.com> | 2025-01-13 07:22:23 +0200 |
commit | f85949f85266768ec1bd5e3d150e4ac71feabcf1 (patch) | |
tree | a6c81c5ec164d209bf0e664d6a6a22ddd42cd63f /2022/02/a.py | |
parent | af9283db3825dbfede0a4127a004f0b077fe6f7c (diff) |
Diffstat (limited to '2022/02/a.py')
-rw-r--r-- | 2022/02/a.py | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/2022/02/a.py b/2022/02/a.py new file mode 100644 index 0000000..1338bbf --- /dev/null +++ b/2022/02/a.py @@ -0,0 +1,43 @@ +points = 0 +p = {"lost": 0, "draw": 3, "won": 6} +p2 = {"X": 1, "Y": 2, "Z": 3} + +sym = {"X": "A", "Y": "B", "Z": "C"} +sym2 = {"A": "X", "B": "Y", "C": "Z"} + +wins = {"C": "X", "A": "Y", "B": "Z"} +wins2 = {"A": "Z", "B": "X", "C": "Y"} + +trans = {"me": {"X": "R", "Y": "P", "Z": "S"}, + "enem": {"A": "R", "B": "P", "C": "S"} + } + +with open("input") as f: + lines = f.readlines() + + +for line in lines: + enem, me = line.split(" ") + enem = enem.strip() + me = me.strip() + print(enem, me) + if me == "X": + me = wins2[enem] + elif me == "Y": + me = sym2[enem] + elif me == "Z": + me = wins[enem] + if (sym[me] == enem): + points = points + p["draw"] + p2[me] + elif (me == "X" and enem == "C"): + points = points + p["won"] + p2[me] + elif (me == "Y" and enem == "A"): + points = points + p["won"] + p2[me] + elif (me == "Z" and enem == "B"): + points = points + p["won"] + p2[me] + else: + points += p2[me] + print(enem, me) + print(points) + print() +print(points) |