master
Tom Weber 2 years ago
parent df3822bee4
commit 1695cacec7

@ -0,0 +1,40 @@
def score_match(x, y):
if x == "A":
if y == "X":
return 3
if y == "Y":
return 6
else:
return 0
if x == "B":
if y == "X":
return 0
if y == "Y":
return 3
else:
return 6
else:
if y == "X":
return 6
if y == "Y":
return 0
else:
return 3
def score(x):
if x == "X":
return 1
if x == "Y":
return 2
else:
return 3
f = open("input.txt", "r")
lines = f.read().splitlines()
current = 0
for line in lines:
x, y = line.split(" ")
current = current + score(y) + score_match(x, y)
print(current)

@ -0,0 +1,40 @@
def score_symbol(x, y):
if x == "A":
if y == "X":
return 3
if y == "Y":
return 1
else:
return 2
if x == "B":
if y == "X":
return 1
if y == "Y":
return 2
else:
return 3
else:
if y == "X":
return 2
if y == "Y":
return 3
else:
return 1
def score_match(x):
if x == "X":
return 0
if x == "Y":
return 3
else:
return 6
f = open("input.txt", "r")
lines = f.read().splitlines()
current = 0
for line in lines:
x, y = line.split(" ")
current = current + score_symbol(x, y) + score_match(y)
print(current)

File diff suppressed because it is too large Load Diff
Loading…
Cancel
Save