1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
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)
|