41 lines
503 B
Python
41 lines
503 B
Python
import shared
|
|
|
|
R = "A"
|
|
P = "B"
|
|
S = "C"
|
|
|
|
X = "X" # lose
|
|
Y = "Y" # tie
|
|
Z = "Z" # win
|
|
|
|
Moves = {
|
|
R: {X: S, Y: R, Z: P},
|
|
P: {X: R, Y: P, Z: S},
|
|
S: {X: P, Y: S, Z: R},
|
|
}
|
|
|
|
Scores = {
|
|
R: 1,
|
|
P: 2,
|
|
S: 3,
|
|
X: 0,
|
|
Y: 3,
|
|
Z: 6,
|
|
}
|
|
|
|
|
|
def run(moves):
|
|
score = 0
|
|
for o, a in moves:
|
|
score += Scores[Moves[o][a]] + Scores[a]
|
|
print(score)
|
|
|
|
|
|
def main():
|
|
rows = [row.rstrip().split() for row in shared.load(2)]
|
|
run(rows)
|
|
|
|
|
|
if __name__ == "__main__":
|
|
main()
|