Skip to content

Commit

Permalink
Add function that calculates group badges priorities sum
Browse files Browse the repository at this point in the history
  • Loading branch information
katzuv committed Dec 10, 2022
1 parent 301616b commit 10245ce
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion puzzles/solutions/2022/d03/p2.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
import functools
import sys

import p1


GROUP_SIZE = 3


Expand All @@ -27,7 +30,10 @@ def get_group_badge(group_rucksacks: list[str]) -> str:


def get_answer(input_text: str):
raise NotImplementedError
"""Return the sum of the priorities of the item types that correspond to the badges of each three-Elf group."""
group_rucksacks = get_group_rucksacks(input_text)
badges = list(map(get_group_badge, group_rucksacks))
return sum((map(p1.get_item_type_priority, badges)))


if __name__ == "__main__":
Expand Down

0 comments on commit 10245ce

Please sign in to comment.