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.
38 lines
617 B
Python
38 lines
617 B
Python
import aocd
|
|
from dotenv import load_dotenv
|
|
|
|
load_dotenv()
|
|
puzzle_input = aocd.get_data(day=2, year=2022)
|
|
|
|
round_result = {
|
|
"A X":4,
|
|
"B X":1,
|
|
"C X":7,
|
|
"A Y":8,
|
|
"B Y":5,
|
|
"C Y":2,
|
|
"A Z":3,
|
|
"B Z":9,
|
|
"C Z":6,
|
|
}
|
|
|
|
round_result_part2 = {
|
|
"A X":3, #0 + 3
|
|
"B X":1, #0 + 1
|
|
"C X":2, #0 + 2
|
|
"A Y":4, #3 + 1
|
|
"B Y":5, #3 + 2
|
|
"C Y":6, #3 + 3
|
|
"A Z":8, #6 + 2
|
|
"B Z":9, #6 + 3
|
|
"C Z":7, #6 + 1
|
|
}
|
|
|
|
strategy_score = 0
|
|
moves_list = puzzle_input.split('\n')
|
|
for move in moves_list:
|
|
strategy_score = strategy_score + round_result_part2[move]
|
|
|
|
print(strategy_score)
|
|
|