-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathday2p2.py
46 lines (38 loc) · 896 Bytes
/
day2p2.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
40
41
42
43
44
45
46
# declare the worth of every factor per match
rock = 1
paper = 2
scissors = 3
win = 6
loss = 0
draw = 3
f = open("aoc.txt", 'r')
score = 0
for line in f:
match = line.strip('\n').split(" ")
enemy = match[0]
player = match[1]
if player == 'X':
score += loss
if enemy == 'A':
score += scissors
elif enemy == 'C':
score += paper
elif enemy == 'B':
score += rock
elif player == 'Y':
score += draw
if enemy == 'A':
score += rock
elif enemy == 'B':
score += paper
elif enemy == 'C':
score += scissors
elif player == 'Z':
score += win
if enemy == 'B':
score += scissors
elif enemy == 'C':
score += rock
elif enemy == 'A':
score += paper
print(score)