2022 day 2

This commit is contained in:
2022-12-02 18:52:42 +00:00
parent 2c9c2248ab
commit 3ccc8b3ebf
3 changed files with 2599 additions and 0 deletions

33
2022/02/part1 Executable file
View 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)