Files
aoc/02/b.py
2022-12-02 12:27:04 +02:00

74 lines
1.3 KiB
Python

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