You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

31 lines
615 B
Python

2 years ago
#!/usr/bin/env python3
INPUT_FILE = 'input'
# x = rock
# y = paper
# z = scissor
# lose = 0
# draw = 3
# win = 6
def main():
score = 0
content = map(str.strip, open(INPUT_FILE, 'r').readlines())
for line in content:
enemy_move, my_move = map(ord, line.split(' '))
enemy_move -= 64
my_move -= 24 + 63
print(enemy_move, my_move)
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()