Definitely a bit more involved for me. Also I forgot part 2 for day 2.
parent
1070f5197e
commit
0d716588a0
14
day_2.py
14
day_2.py
|
@ -16,10 +16,22 @@ round_result = {
|
|||
"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[move]
|
||||
strategy_score = strategy_score + round_result_part2[move]
|
||||
|
||||
print(strategy_score)
|
||||
|
||||
|
|
4
day_3.py
4
day_3.py
|
@ -31,6 +31,4 @@ for r, rucksack in enumerate(rucksacks):
|
|||
badges_priority = badges_priority + ord(in_badge) - 38
|
||||
|
||||
print(f'These elves are carrying a total of {total_priority:,} (prioritized?) things. That\'s a lotta stuff.')
|
||||
print(f'They\'re also v important with a total badge priority of {badges_priority:,}.')
|
||||
|
||||
|
||||
print(f'They\'re also v important with a total badge priority of {badges_priority:,}.')
|
5
day_5.py
5
day_5.py
|
@ -18,7 +18,10 @@ for m,move in enumerate(moves):
|
|||
column_to = int(move.split(',')[2])-1
|
||||
column_from = int(move.split(',')[1])-1
|
||||
moved_number = int(move.split(',')[0])
|
||||
cargo[column_to] = cargo[column_to] + list(reversed(cargo[column_from][-moved_number::]))
|
||||
# Part 1
|
||||
# cargo[column_to] = cargo[column_to] + list(reversed(cargo[column_from][-moved_number::]))
|
||||
# Part 2
|
||||
cargo[column_to] = cargo[column_to] + cargo[column_from][-moved_number::]
|
||||
cargo[column_from] = cargo[column_from][:-moved_number]
|
||||
|
||||
answer = []
|
||||
|
|
Loading…
Reference in New Issue