Files
aoc/02/b.py
2022-12-02 09:37:34 +02:00

55 lines
1.1 KiB
Python

import os
f = open(os.path.dirname(__file__)+"/input.txt", "r")
tot = 0
i = 0
for l in f:
l.strip()
choices = l.split(" ")
result = 'draw'
v = choices[0]
o = choices[1]
print (v + " " + o)
match v:
case 'A':
if o == 'Y':
result = 'win'
print("voitto")
if o =='Z':
result = 'loss'
print("tappio")
case 'B':
if o == 'X':
result = 'loss'
print("tappio")
if o == 'Z':
result = 'win'
print("voittko")
case 'C':
if o == 'X':
result = 'win'
print("voitto")
if o == 'Y':
result = 'loss'
print("tappio")
match choices[1]:
case 'X':
tot = tot + 1
case 'Y':
tot = tot + 2
case 'Z':
tot = tot + 3
if result == 'draw':
tot = tot + 3
if result == 'win':
tot = tot + 6
i = i + 1
print(tot)
print(tot)
print(i)