2022-12-25 15:10:36 +00:00
|
|
|
with open('input.txt', 'r') as f:
|
2022-12-02 18:35:14 +00:00
|
|
|
# Part 1
|
|
|
|
matches = [rpsMatch.split(' ') for rpsMatch in f.read().split('\n')]
|
|
|
|
score = 0
|
|
|
|
for rpsMatch in matches:
|
|
|
|
if rpsMatch[0] == 'A':
|
|
|
|
if rpsMatch[1] == 'X':
|
|
|
|
score += 1 + 3
|
|
|
|
elif rpsMatch[1] == 'Y':
|
|
|
|
score += 2 + 6
|
|
|
|
elif rpsMatch[1] == 'Z':
|
|
|
|
score += 3
|
|
|
|
elif rpsMatch[0] == 'B':
|
|
|
|
if rpsMatch[1] == 'X':
|
|
|
|
score += 1
|
|
|
|
elif rpsMatch[1] == 'Y':
|
|
|
|
score += 2 + 3
|
|
|
|
elif rpsMatch[1] == 'Z':
|
|
|
|
score += 3 + 6
|
|
|
|
elif rpsMatch[0] == 'C':
|
|
|
|
if rpsMatch[1] == 'X':
|
|
|
|
score += 1 + 6
|
|
|
|
elif rpsMatch[1] == 'Y':
|
|
|
|
score += 2
|
|
|
|
elif rpsMatch[1] == 'Z':
|
|
|
|
score += 3 + 3
|
|
|
|
print(f"Total score: {score}")
|