day02
This commit is contained in:
28
02/solve01.py
Normal file
28
02/solve01.py
Normal file
@ -0,0 +1,28 @@
|
||||
#/usr/bin/env python
|
||||
|
||||
# AX, 1, Rock
|
||||
# BY, 2,Paper
|
||||
# CZ, 3, Scissors
|
||||
# loss, 0
|
||||
# draw, 3
|
||||
# win, 6
|
||||
|
||||
SCORE = {
|
||||
'AX': 4, # Rock, Rock, Draw
|
||||
'AY': 8, # Rock, Paper, Win
|
||||
'AZ': 3, # Rock, Scissors, Loss
|
||||
'BX': 1, # Paper, Rock, Loss
|
||||
'BY': 5, # Paper, Paper, Draw
|
||||
'BZ': 9, # Paper, Scissors, Win
|
||||
'CX': 7, # Scissors, Rock, Win
|
||||
'CY': 2, # Scissors, Paper, Loss
|
||||
'CZ': 6, # Scissors, Scissors, Draw
|
||||
}
|
||||
|
||||
score = 0
|
||||
with open("input.txt", "r") as f:
|
||||
for line in f:
|
||||
line = line.replace(" ", "").strip()
|
||||
score += SCORE[line]
|
||||
|
||||
print(score)
|
||||
Reference in New Issue
Block a user