move priority list

This commit is contained in:
aaron
2022-12-03 14:51:28 +01:00
parent 5cd5b10ec1
commit 0c9ac4346d

View File

@@ -3,15 +3,15 @@ import string
from aocd.models import Puzzle from aocd.models import Puzzle
from aocd import submit from aocd import submit
# create a map of priority values
priorities = dict(zip(string.ascii_letters, range(1, 53)))
def eval_item_priority(rucksack: str) -> int: def eval_item_priority(rucksack: str) -> int:
""" """
evaluates the priority of a common item evaluates the priority of a common item
""" """
# create a map of priority values
priorities = dict(zip(string.ascii_letters, range(1, 53)))
# slize rucksack into compartments # slize rucksack into compartments
size = len(rucksack) size = len(rucksack)
a, b = rucksack[: size // 2], rucksack[size // 2 :] a, b = rucksack[: size // 2], rucksack[size // 2 :]
@@ -28,9 +28,6 @@ def eval_badge_priority(rucksacks: list) -> int:
evaluate the priority of duplicate items over groups of three rucksacks evaluate the priority of duplicate items over groups of three rucksacks
""" """
# create a map of priority values
priorities = dict(zip(string.ascii_letters, range(1, 53)))
# find common item amongst three sets # find common item amongst three sets
common = "".join(set(rucksacks[0]) & set(rucksacks[1]) & set(rucksacks[2])) common = "".join(set(rucksacks[0]) & set(rucksacks[1]) & set(rucksacks[2]))