finished day 5

This commit is contained in:
gabe 2022-08-26 14:07:57 -05:00
parent 122e48ef5d
commit 5b996a5019
4 changed files with 942 additions and 0 deletions

46
day5/day5.py Executable file
View file

@ -0,0 +1,46 @@
#! /usr/bin/env python3
import pathlib
import sys
import re
from dataclasses import dataclass
from pprint import pprint
def row_to_int(string: str)->int:
return int(string.replace('F','0').replace('B','1'),2)
def col_to_int(string: str)->int:
return int(string.replace('L','0').replace('R','1'),2)
def parse(puzzle_input: str):
"""Parse input"""
rows_and_cols = [(row_to_int(x[:7]),col_to_int(x[7:])) for x in puzzle_input.splitlines()]
return set([x[0]*8+x[1] for x in rows_and_cols])
def part1(data):
"""Solve part 1"""
return max(data)
def part2(data):
"""Solve part 2"""
for row in range(128):
for col in range(8):
potentialID=row*8+col
if potentialID not in data:
if (potentialID+1 in data) and (potentialID-1 in data):
return potentialID
def solve(puzzle_input):
"""Solve the puzzle for the given input"""
data = parse(puzzle_input)
solution1 = part1(data)
solution2 = part2(data)
return solution1, solution2
if __name__ == "__main__":
for path in sys.argv[1:]:
print(f"{path}:")
puzzle_input = pathlib.Path(path).read_text().strip()
solutions = solve(puzzle_input)
print("\n".join(str(solution) for solution in solutions))

4
day5/example1 Normal file
View file

@ -0,0 +1,4 @@
FBFBBFFRLR
BFFFBBFRRR
FFFBBBFRRR
BBFFBBFRLL

859
day5/input Normal file
View file

@ -0,0 +1,859 @@
BBFFBFFRRR
FBBFFBBLRR
FFBFBFBRRR
FFFBFBFRRR
BBFFBBFLRR
BFFBFBFLRL
FBBBBBFRRR
FFFFBFFLLR
BFBFFBFLLR
FFBBFFFLRR
BFFFFFFLLL
FBFFBFFRLL
FFBFFBFRLR
FBBBFBFRRR
FBFFBBBRRL
FBFFBFFLRL
BFBBFFFLLL
FBBFBFBRRL
BFFBFFFLRR
FFFFBFFRLR
FFFBBBFRLR
FBFFFBFLLL
BFBFBBBLRR
FBBBFFBRLR
BBFFFFFLLL
BFFFFBFRRL
FBBBFBFRRL
FFBBBFBRLR
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IR = pathlib.Path(__file__).parent
#these test fixtures setup the test, mainly by reading the filename into a string in this simple case.
@pytest.fixture
def example1():
puzzle_input = (PUZZLE_DIR / "example1").read_text().strip()
return aoc.parse(puzzle_input)
@pytest.fixture
def example2():
puzzle_input = (PUZZLE_DIR / "example2").read_text().strip()
return aoc.parse(puzzle_input)
# @pytest.mark.skip(reason="Not implemented")
def test_parse_example1(example1):
"""Test that input is parsed properly"""
assert example1 == [(44,5), (70,7), (14,7), (102, 4)]
# @pytest.mark.skip(reason="Not implemented")
def test_part1_example1(example1):
"""Test part 1 on example input"""
assert aoc.part1(example1) == 820
@pytest.mark.skip(reason="Not implemented")
def test_part2_example2(example2):
"""Test part 2 on example input"""
assert aoc.part2(example2) == ...