38 lines
836 B
Python
Executable File
38 lines
836 B
Python
Executable File
#!/usr/bin/env python3
|
|
|
|
INPUT_FILE = 'input'
|
|
|
|
# rock = 1
|
|
# paper = 2
|
|
# scissor = 3
|
|
|
|
# lose = X
|
|
# draw = Y
|
|
# win = Z
|
|
|
|
def main():
|
|
score = 0
|
|
content = map(str.strip, open(INPUT_FILE, 'r').readlines())
|
|
for line in content:
|
|
enemy_move, game_result = line.split(' ')
|
|
enemy_move = ord(enemy_move)-64
|
|
if game_result == 'X':
|
|
# lose
|
|
my_move = enemy_move - 1 or 3
|
|
elif game_result == 'Y':
|
|
# draw
|
|
my_move = enemy_move
|
|
elif game_result == 'Z':
|
|
# win
|
|
my_move = ( enemy_move % 3 ) + 1
|
|
if my_move == enemy_move + 1 or (my_move == 1 and enemy_move == 3):
|
|
score += 6
|
|
elif my_move == enemy_move:
|
|
score += 3
|
|
score += my_move
|
|
|
|
print(score)
|
|
|
|
if __name__ == '__main__':
|
|
main()
|