2022 day 2
This commit is contained in:
33
2022/02/part1
Executable file
33
2022/02/part1
Executable file
@@ -0,0 +1,33 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
# lose: 0
|
||||
# draw: 3
|
||||
# win: 6
|
||||
|
||||
outcomes = {
|
||||
'A': { # rock: 1
|
||||
'X': 1 + 3, # rock
|
||||
'Y': 2 + 6, # paper
|
||||
'Z': 3 + 0 # scissors
|
||||
},
|
||||
'B': { # paper: 2
|
||||
'X': 1 + 0, # rock
|
||||
'Y': 2 + 3, # paper
|
||||
'Z': 3 + 6 # scissors
|
||||
},
|
||||
'C': { # scissors: 3
|
||||
'X': 1 + 6, # rock
|
||||
'Y': 2 + 0, # paper
|
||||
'Z': 3 + 3 # scissors
|
||||
}
|
||||
}
|
||||
|
||||
score = 0
|
||||
|
||||
with open('input') as f:
|
||||
for line in f:
|
||||
moves = line.rstrip().split(" ")
|
||||
score = score + outcomes[moves[0]][moves[1]]
|
||||
|
||||
print(score)
|
||||
|
Reference in New Issue
Block a user