16 lines
486 B
Python
16 lines
486 B
Python
with open("day2\input.txt") as f:
|
|
data = f.readlines()
|
|
# Pad Rock Paper Scissors
|
|
opponent_hand = ["A","B","C"]
|
|
my_hand = ["X","Y","Z"]
|
|
total_sum = 0
|
|
for line in data:
|
|
my_score = my_hand.index(line[2])+1
|
|
his_score = opponent_hand.index(line[0])+1
|
|
if (my_score == 1 and his_score == 3) or (his_score == my_score-1):
|
|
total_sum += 6 #Victory
|
|
if my_score == his_score:
|
|
print("Draw")
|
|
my_score += 3
|
|
total_sum += my_score
|
|
print(total_sum) |