adventofcode/2022/02/01.py
2022-12-02 20:42:37 +01:00

31 lines
615 B
Python
Executable File

#!/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()