-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathday2-2.py
39 lines (39 loc) · 858 Bytes
/
day2-2.py
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
#!/usr/local/bin/snek
# cat day2input.txt | snek ./day2-2.py
sum = 0
s = input()
while s != '.':
opponent = chr(ord(s[0])+ord('X')-ord('A'))
if opponent == 'X':
correct = 'Y'
wrong = 'Z'
elif opponent == 'Y':
correct = 'Z'
wrong = 'X'
elif opponent == 'Z':
correct = 'X'
wrong = 'Y'
outcome = s[2]
if outcome == 'X':
response = wrong
elif outcome == 'Y':
response = opponent
elif outcome == 'Z':
response = correct
if response == 'X':
shape = 1
elif response == 'Y':
shape = 2
elif response == 'Z':
shape = 3
print(shape)
if response == correct:
score = 6
elif response == opponent:
score = 3
else:
score = 0
print(score)
sum += shape + score
s = input()
print(sum)