From bf10fcb367da397fe77222f796a03f94d1e029d2 Mon Sep 17 00:00:00 2001 From: earnest ma Date: Sat, 3 Dec 2022 21:56:28 -0500 Subject: [PATCH] 2022/day03: Done! --- 2022/day03.py | 77 ++++++++++++ 2022/day03.txt | 300 +++++++++++++++++++++++++++++++++++++++++++++ 2022/day03_test.py | 15 +++ 3 files changed, 392 insertions(+) create mode 100644 2022/day03.py create mode 100644 2022/day03.txt create mode 100644 2022/day03_test.py diff --git a/2022/day03.py b/2022/day03.py new file mode 100644 index 0000000..056c23b --- /dev/null +++ b/2022/day03.py @@ -0,0 +1,77 @@ +#!/usr/bin/env python3 + + +from typing import TextIO + +ltrs = "abcdefghijklmnopqrstuvwxyz" +# lowercase: pos + 1 +# uppercase: pos + 27 + + +def find_common_char(one: str, two: str) -> str: + for a in one: + for b in two: + if a == b: + return a + + return "" + + +def find_common_char_three(one: str, two: str, three: str) -> str: + for a in one: + for b in two: + for c in three: + if a == b == c: + return a + + return "" + + +def get_priority(ltr: str) -> int: + + n = ltrs.find(ltr.lower()) + + if ltr.isupper(): + return n + 27 + + return n + 1 + + +def part1(sacks: TextIO) -> int: + + sum: int = 0 + for sack in sacks: + first = sack[: len(sack) // 2] + second = sack[len(sack) // 2 :] + + sum += get_priority(find_common_char(first, second)) + + return sum + + +def part2(sacks: TextIO) -> int: + sum: int = 0 + + line = sacks.readline().strip() + + while line != "": + a, b, c = "", "", "" + + for i in range(0, 3): + if line != "": # lol + a = line + line = sacks.readline().strip() + b = line + line = sacks.readline().strip() + c = line + + line = sacks.readline().strip() + + sum += get_priority((find_common_char_three(a, b, c))) + + return sum + + +if __name__ == "__main__": + print(part1(open("day03.txt"))) + print(part2(open("day03.txt"))) diff --git a/2022/day03.txt b/2022/day03.txt new file mode 100644 index 0000000..1524f4b --- /dev/null +++ b/2022/day03.txt @@ -0,0 +1,300 @@ +ZTmtZvZLTFNLMQMNRvZncdcHwcScJvcdHnVfwV +zqjqrzqjCqrjtqWhqChqrznhcfdfVnVSV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+fMMfwWdWrNfJNdlVgMcTLTmLffjTqnLScCjL +SwhTllwJDwqqBWLBbNtfhjBB +mvllZMmRMZGFZRfctLWtWttzfNLR +MGvHMCGpVnFGlgvVFFnpnGmmsHrDJJdSsqPqJSqDJJdTTDqD +QTTcqJZJhHSpShhFpFzjDDwwsFzpdg +NBMnBvmBPvwrqvgvvqgD +bNNGmWmbbClQTQRqchhQbf diff --git a/2022/day03_test.py b/2022/day03_test.py new file mode 100644 index 0000000..cd2ae08 --- /dev/null +++ b/2022/day03_test.py @@ -0,0 +1,15 @@ +#!/usr/bin/env python3 + +from day03 import * + + +def test_part1() -> None: + sacks = open("day03.txt") + assert part1(sacks) == 7716 + sacks.close() + + +def test_part2() -> None: + sacks = open("day03.txt") + assert part2(sacks) == 2973 + sacks.close()