day 2
parent
5a7bf9b365
commit
b5390324a4
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,32 @@
|
|||
scores = {
|
||||
"A X": 1+3,
|
||||
"B X": 1+0,
|
||||
"C X": 1+6,
|
||||
"A Y": 2+6,
|
||||
"B Y": 2+3,
|
||||
"C Y": 2+0,
|
||||
"A Z": 3+0,
|
||||
"B Z": 3+6,
|
||||
"C Z": 3+3,
|
||||
}
|
||||
|
||||
|
||||
|
||||
t = 0
|
||||
with open("input") as f:
|
||||
for game in f:
|
||||
t += scores[game.strip()]
|
||||
|
||||
print(t)
|
||||
|
||||
t2 = 0
|
||||
with open("input") as f:
|
||||
for game in f:
|
||||
you, me = game.split()
|
||||
a="ABC".index(you)
|
||||
b="YZX".index(me)
|
||||
play = 1+(a+b)%3
|
||||
outcome = (b+1)%3
|
||||
t2 += play + outcome*3
|
||||
|
||||
print(t2)
|
|
@ -0,0 +1,3 @@
|
|||
A Y
|
||||
B X
|
||||
C Z
|
Loading…
Reference in New Issue