Files
aoc/02/b.py
2022-12-02 07:21:42 +02:00

26 lines
502 B
Python

import os
f = open(os.path.dirname(__file__)+"/input.txt", "r")
tot = 0
selection = {'X': 1, 'Y': 2, 'Z': 3}
for l in f:
choices = l.split(" ")
result = 'draw'
match choices[0]:
case 'A':
match choices[1]:
case 'Y':
result = 'win'
case 'Z':
result = 'loss'
tot = tot + selection.get(choices[1])
if result == 'draw':
tot = tot + 3
if result == 'win':
tot = tot + 6