From 38674a3ea483cd23a2f46ad22efe18292b065876 Mon Sep 17 00:00:00 2001 From: Galen Rice Date: Tue, 17 Dec 2024 11:53:37 -0500 Subject: [PATCH] chore: days 16 and 17 scaffolded, test cases added --- 2024/inputs/day16.txt | 141 ++++++++++++++++++ 2024/inputs/day17.txt | 5 + 2024/inputs/tests/test_day16_ex1.txt | 15 ++ 2024/inputs/tests/test_day16_ex2.txt | 17 +++ 2024/inputs/tests/test_day17.txt | 5 + 2024/python/pyproject.toml | 2 + .../src/grice_py_aoc_2024/day16/__init__.py | 0 .../src/grice_py_aoc_2024/day16/main.py | 37 +++++ .../src/grice_py_aoc_2024/day16/test_day16.py | 35 +++++ .../src/grice_py_aoc_2024/day17/__init__.py | 0 .../src/grice_py_aoc_2024/day17/main.py | 37 +++++ .../src/grice_py_aoc_2024/day17/test_day17.py | 26 ++++ 12 files changed, 320 insertions(+) create mode 100644 2024/inputs/day16.txt create mode 100644 2024/inputs/day17.txt create mode 100644 2024/inputs/tests/test_day16_ex1.txt create mode 100644 2024/inputs/tests/test_day16_ex2.txt create mode 100644 2024/inputs/tests/test_day17.txt create mode 100644 2024/python/src/grice_py_aoc_2024/day16/__init__.py create mode 100644 2024/python/src/grice_py_aoc_2024/day16/main.py create mode 100644 2024/python/src/grice_py_aoc_2024/day16/test_day16.py create mode 100644 2024/python/src/grice_py_aoc_2024/day17/__init__.py create mode 100644 2024/python/src/grice_py_aoc_2024/day17/main.py create mode 100644 2024/python/src/grice_py_aoc_2024/day17/test_day17.py diff --git a/2024/inputs/day16.txt b/2024/inputs/day16.txt new file mode 100644 index 0000000..4bb48f3 --- /dev/null +++ b/2024/inputs/day16.txt @@ -0,0 +1,141 @@ +############################################################################################################################################# +#.#.....#...#...........#...........#.....#.......#.......#.....#...............#.........#.....#...#.....#.......#........................E# +#.#.###.#.#.#.###.###.#.###.#.###.###.#.#.#.#.###.#####.#.#.###.###.###.#####.###.#####.#.#.#.#.###.#.#.#.###.###.#.###.#.#.###.#######.###.# +#.....................#.....#.#...#...#.#.#.#...#...#...#.#...#...#.#.......#.....#...#.#.#.#.#...#...#.#...#...#.#...#.#.#.#...#.....#.....# +#.#.#.#########.#.#.###########.#.#.###.#.#.###.###.#.###.###.###.#.###.#.#.#########.#.#.#.#.###.#.###.###.###.#.###.#.#.#.#.#.#.#.#.#.##### +#.#.#.......#...#...#...................#.#...#...#...#.#.....#.#.#...#.#.#.....#.....#.#.#.#...#.#...#...#.....#.#...#...#...#...#.#.#...#.# +#.#.#.#####.#.###.#.#.#.#.#.#.###.#####.###.#####.#####.#######.#.###.#.#.#####.###.#.#.###.###.#.#####.#.#######.#.###########.###.#####.#.# +#.#.#...#...#.#...#.#.#...#.#...#.#.....#.........................#...#.#...#.#.....#.#.....#...#...............#.#.#...#.......#...#.....#.# +#.#.###.#####.#.#.#.#.#####.###.#.#.#####.#.#.#####.###.#########.#.###.###.#.###.###########.#.#######.###.#.#.#.#.#.#.#.#.###.#.#.#.#####.# +#.#.....#.....#.#.#.#.#...#...#...#.........#.#...#...#...........#...#...#.#.#...#...........#.........................#.#.#.#...#.#.......# +#.#.###.#.#####.###.#.#.#.#.#.#.#.#########.#.###.###.#########.#####.#####.#.#.###.###########.###.#.#.#####.#####.###.###.#.#.###.#######.# +#.............#.....#.#.#.#.#.#.#.....#...#...#.....#.#.......#.....#.....#.#...#.#...#...#...#...#...#.....#.#.......#.....................# +#.#.#####.#.#.#######.#.###.#.#.#.###.#.#.#.###.#####.#.#####.#.#########.#.#.###.###.#.###.#.#.#.###.#.#.#.#.###########.#.#.#.#.#.#.###.### +#...#...#...#.#.........#...#.....#...#.#...#.......#.#...#.#.#.......#.#...#.#.....#.#.#...#...#.#...#.#.#.#.#.......#...#.#...#.....#...#.# +#.#.#.#.###.#.#.#########.#####.#.#.###.#.#.#######.#.#.#.#.#.#.###.#.#.#.###.#####.#.#.#.#####.#.#.###.#.#.#.#.#####.#.###.###.#.#####.###.# +#.#...#.....#.#...#.....#...#.......#.....#...#.....#.#...#...#...#.#.....#.........#.#...#.......#.#...#.#.#...#...#.#...#.....#.#.........# +#.#.#######.#.###.#.#.#.###.#.###.###.#####.#.#.###.#.###.#.#######.#####.#.###.#####.#.###.#######.#####.#.#####.#.#.###.#.###.###.#.#.#.#.# +#.#...#.....#...#...#.#...#.....#...#.......#.#...#.#.....#.......#.#...#.#...#.#.....#.#...#.....#.......#.#.....#.#.....#...#.#...#.#.#.#.# +#.#.###.###.#.#.#.#.#.###.#####.#.#.#########.#.#.###############.#.#.#.#####.#.#.#####.#.###.###.#########.#####.#.#########.#.#.###.#.#.#.# +#.....#...#...#.....#...#...#.#.#.#...........#.#...#.....#.......#...#.....#...#.#...#.#.#.....#.........#.....#.#.#.....#...#...#.#...#.#.# +#.###.###.#.#.#.###.###.###.#.#.#.###.#.#######.###.#.#.#.#.#.#.###.#####.#.###.#.#.###.#.#.#######.#.#.#######.#.#.#.###.#.#######.#######.# +#...#.....#.#.#.#.......#.#.#...#...#.#.#.........#...#.....#.#.#.......#.#...#.#.#.#...#...#.....#...#.........#.#.#...#.#.#.....#.......#.# +#.#.#####.#.#.#.#.#####.#.#.#.###.#.###.#.###########.#.###.#.#.#.#####.#.#.#.#.#.#.#.#####.#.###.#.#.#######.#.#.###.###.#.###.#.#.#####.#.# +#.#...#...#.#.#.#.#.......#.#.#...#.#...#.#.....#...#.#.#.....#.........#.#.#...#.#.#.#.....#.#.#...#.........#...#...#...#.....#...#...#...# +#.#.###.###.#.###.#.#.#.###.#.#####.#.###.#####.#.#.###.#.#####.#.#####.#.#.#####.#.#.#.#.###.#.#####.###.#####.###.###.#############.#.#.#.# +#.#.#...#...#.....#.#.#.#...#.#.....#.#.....#...#.#.....#.....#...#...#.#...#...#.#.#.#.#.#...#.....#...#.....#.#...#.#.......#.....#.#...#.# +#.###.###.###.#####.#.###.###.#.###.#.#####.#.###.#####.#########.#.###.#####.#.#.#.#.###.#.###.###.#.#.###.#.#.#.###.#####.###.#.###.#.#.#.# +#.......#.....#.....#...#.#...#...#.#...#.....#...#.....#...#.....#.........#.#...#.#.....#.#...#.#...#.#...#...#.........#.....#.....#.#.#.# +#.#.###.#####.#.#.###.#.#.#.#.###.#####.#.#####.###.#####.#.#.###########.###.#####.###.###.#.###.#####.#.#.#############.#############.#.#.# +#...#...#...#.#.#...#.#...#.....#...#...#.#.#...#...#.....#...#.......#.....#.#.#.......#...#.........#.....#...........#.#...#.......#.....# +#.###.#.#.#.#.#.###.#.###.#####.###.#.###.#.#.###.###.#############.#.#.#.#.#.#.#.#####.#.###########.#####.#.#######.#.#.#.#.#######.###.### +#.#...#.#...#...#...#.........#.....#...#...#.#.....#...#.....#.....#.#...#.#.....#.....#.........#...#...#.#.#.#.....#.#...#.......#.......# +#.#.#.#.#.###.#.#.###########.#####.###.#####.#.#######.#.###.#.#####.#.#.#.#.###.#.###.###.#####.#.###.#.###.#.#.#####.###########.#.#.#.### +#.#.#.#...#...#.#.....#...#.....#.....#...#...#.#...#...#...#...#.#...#.#.#.#...#.#.#.#.......#.#.#.#...#.......#.#.#...#...#.....#.#.#.....# +#.###.#.###.#.#######.###.#.#.#.#.#######.#.###.#.#.#.###.#.###.#.#.###.#.#.#.#.###.#.###.###.#.#.###.###########.#.#.#.#.#.#.#.###.#.###.#.# +#...#.#.#...#.......#...#.#.#...#.#.......#...#.#.#.#.....#.....#.......#.#...#.#...#.#...#.#...#.....#.#.....#...#.#.#...#.#.#.#...#.#...#.# +###.#.###.#########.###.#.#.#.#.#.#.#######.#.###.#.#####.#.###.###.###.#.#.#.#.#.###.#.###.###.#######.#.#.###.###.#.###.#.#.#.#.###.###.#.# +#.#...#...#...#.....#...#...#.#.#.#.#...#...#.....#.....#.#...#...#...#.#.#.#.#...#...#.#...#.#...#...#...#.#...#.....#...#.#.#.#...#.....#.# +#.###.#.#####.#.#####.###.###.#.#.#.#.#.#.###########.#.#.#######.###.#.#.#.#.#####.#.#.#.#.#.###.#.###.###.#.###.#####.###.#.#####.#####.#.# +#.....#.#.....#.#.....#...#...#...#.#.#.#...#.......#.#...#...#...#.#.#.#.#...#...#.#.#.#.#...#...#.......#.#.#.#.......#.................#.# +#.#####.#.#.#.#.###.###.#.#.#######.#.#.###.#.#####.#####.#.#.#.###.#.###.#.#.#.#.#.#.#.#.#####.#####.#####.#.#.#.#########.###.#####.###.#.# +#.#.....#.#.#.#.....#.#...#.#...#...#.#.#...#...#...#...#...#.....#.......#.#.#.#.#.#.#.#...#...#...#.#...#.#.#...#...........#.#.......#...# +#.#.#.#####.#.#.#####.#.###.#.#.#.###.#.#.#####.#.###.#.#####.###.#########.#.#.#.###.#.#.#.#.###.#.#.#.#.#.#.#####.#########.#.#########.### +#.#.#.#...#.#.#.......#.#...#.#.#.....#.#.#.#...#.....#...#.#...#...#.......#...#.#...#.#.#.......#.#.#.....#.#.....#.......#.#.....#...#...# +#.#.###.#.#.###.#####.#.#.###.#.#######.#.#.#.#.#########.#.###.#.#.###.#########.#.#.#.#####.#####.###.#####.#.###########.#.#.###.#.#.#.#.# +#.#.#...#.#.....#...#...#...#.#.#...#...#...#.#.#...#.#...#...#.#.#...#.#.......#...#.#.#...#.#...#.#...#...#...#.........#.#.....#...#...#.# +#.#.#.###.#.#####.#########.#.#.#.#.#.#.###.#.###.#.#.#.#####.#.#####.#.#.#.###.#####.#.#.#.###.#.#.#.###.#.###.#.#.#####.#.###.#.#######.#.# +#...#.#...#...#.......#.....#.#.#.#...#.#...#.....#.#...#.....#.......#.#.#...#.......#...#.....#.#.#.#...#...#.#.#.#.....#...#...#.....#.#.# +#.###.#.#.###.#####.###.#####.#.#.#####.#.#.#######.#.###.#.###########.#.###.#######.#.#########.#.#.#.#####.#.###.#.#######.#.#.###.#.#.#.# +#...#.#.....#.#...#...#.#.....#.#.......#.#.........#.#...#.#.......#...#.#.#...#.....#.......#...#...#.#...#.#.....#.........#.#.....#.#.#.# +#.#.#.#####.#.#.#.###.#.#.#####.#####.#.#.###########.###.###.#.#.#.#.###.#.###.#####.###.#####.#.#####.#.#.#.#########.#.#.###.#.#######.#.# +#.#.#.#...#.#.#.#...#...#.....#...#.#.#.#...#.......#...#.........#.#.#.#.....#.....#...#.#...#.#.#.......#.#...#.....#.#.#...#...........#.# +###.#.#.#.#.#.#.###.#.#######.###.#.#.#####.#.#####.###.#######.#.###.#.#####.#####.###.#.#.#.#.#.#.#.#####.###.#.###.#.#####.#.#########.#.# +#...#.#.........#...#.........#.....#.....#.#.#...#...#.......#.#.....#...........#...#.#.#.#.#.#.#.#...#.#.#...#...#.#...#...#.............# +#.###.#.#.#.#####.#####.###########.#####.#.###.#.#.#########.###.#.#.###########.###.#.###.#.#.###.#.#.#.#.#.#####.#.###.#.###.#.#######.#.# +#.......#.#...#...#.....#...#...#.#.#...#.#.....#.#.#.........#.....#.......#...#.#.#.#.#...#...#...#.#.#...#.#.....#...#.#.#...#.#.....#.#.# +#####.#.###.#.#.###.#.#.#.#.#.#.#.#.###.#.#####.#.#.#.#####.###.###.#######.#.#.#.#.#.#.#.#####.#.###.#.#####.#.#.#######.#.#.#.#.#.###.#.#.# +#...#.#...#.#.#.#...#.#.#.#.#.#.#...#...#.#...#...#.#.#.....#...#.#...#.....#.#.#.#.#.#.#.....#.#...#.#.#.....#.#.........#...#.#.#.#.#.#.#.# +#.#.###.#.###.#.###.#.###.#.#.#.#.###.#.#.#.#.#.###.#.###.#.###.#.###.#####.#.###.#.#.#.###.#.###.###.#.#.#####.#.#########.###.#.#.#.#.#.#.# +#.#.....#...#.#.....#.....#.#.#.#.....#.#.....#...#.......#.#...#...#.....#.#.......#.#.....#.#...#...#...#...#.#.........#.....#...#.#.#...# +#.#########.#.#############.#.#.#############.###.#.#######.#.###.#.#####.#.#######.#.#.###.#.#.###.#######.#.#.#.#######.#####.###.#.#.#.### +#...#.....#...#.....#.......#.#.#.............#.#.#.#...#.....#...#.....#.#.....#...#.#.#...#...#...#.......#.#.#.#...#...#.........#.#.#.#.# +###.#.###.#####.###.#.#.#####.#.#.###########.#.#.###.#.###########.###.#.#####.#####.#.#.###.###.###.###.#####.#.#.#.#.#######.###.#.#.#.#.# +#...#.#.....#.....#.#.........#.#...#.#.....#...#...#.#.#.........#.#...#...#.........#.#.#...#...#.#.#.#.......#.#...........#...#.#.#.#...# +#.###.#.###.#.###.#############.#.#.#.#.###.###.###.#.#.#.#######.#.#######.###########.#.###.#.###.#.#.#########.#.#########.###.#.#.#.#.#.# +#...#.#...#.#.#.#.#...........#.#.#.#.#.#...........#.#...#.....#.#.......#...#...#.....#...#.#.#...#...#.........#.....#...#...#.#...#.#.#.# +#.#.#####.###.#.#.#.###.#####.#.###.#.#.#.###.#.#.###.#####.###.#.#####.#.###.###.#.###.###.#.#.###.###.#.#.#######.###.#.#.###.#.#.#.#.#.#.# +#.#.....#...#...#...#.#...#...#.....#.#.#.#...#.#.....#...#...#.#.....#.#...#.#...#...#...#.#.#...#.#...#.#...#...#...#...#...#.#.....#.#...# +#.#####.#.#.###.#####.#.#.#.#########.#.#.#####.#######.#.#.###.#####.###.#.#.#.#####.###.#.#.###.#.#.#######.#.#####.#######.#.###.#.#.#.### +#.....#.#.#.....#.....#...#.......#.....#.........#.....#...#...#...#...#.#.#.#...#...#...#.#...#.#.#.#.......#.#.....#.....#.#.....#.#.....# +#####.#.#.#######.###.#.###########.#############.#.#######.#.#.#.#.###.#.###.#.#.#.###.###.#####.#.#.#.###.###.#.#####.#.###.#.###.#######.# +#.#...#.#.....#.....#.#...........#.#...#.....#...#...#.....#.#.#.#...#.#.....#.#...#.#.....#.....#.#.#...#...#...#.....#.#.......#.....#...# +#.#.###.#####.#######.###########.#.#.#.#.###.#.#####.#.###.#.###.###.###.#####.#####.#######.#####.#.###.#.#.#.#####.#.#.#.###.###.###.#.### +#...#...#.#...#.........#.........#.#.#.#.#.#.#.#.....#...#.#...#.........#.#...#.......#.....#.....#.#...#.#...#...#...#.#.........#...#...# +#####.###.#.###.#######.#.#######.#.#.###.#.#.#.#.#.###.#.#.###.###.#.###.#.#.###.#######.#.###.###.#.#.#####.#.#.#.#####.#####.###.#.#####.# +#...#.#...#.....#...#...#...#.....#.#...#...#.#.#.....#.#.#.#.#...#.#.#...#.#...#.........#.#.....#.#.#.#...#.....#...#...........#.#.....#.# +#.#.#.#.#.#.#####.#.#.#####.#######.###.###.#.#######.#.#.#.#.###.#.#.#.###.###.###########.#.###.###.#.#.#.#########.#.#######.###.#####.#.# +#.#...#.#.#.....#.#.#.#...#.......#...#...#.#.#.......#...#.#...#...#...#...#.#.............#.#...#...#...#.....#...#.#.....#.....#.....#.#.# +#.#####.#.#.#.###.#.#.###.#######.###.###.#.#.#.#######.###.#.###########.#.#.#################.###.#####.#####.#.###.#####.#.#.#.#.#.#.#.#.# +#.#...#.#.#.#.....#.#.....#.....#.........#.#.#.#.......#.....#.........#.#.....#.........#.........#...#.....#.#...#.......#...#.#.#.#.#.#.# +#.#.#.###.#.#######.#####.###.#.###########.#.#.#.#####.#######.#####.#.#.#######.#######.#.#.###.###.#.#######.#.#.###.#######.#.#.#.###.#.# +#...#.#...#.........#...#...#.#...#...#.....#...#...#...#...#...#.....#.#.#.....#.......#...#.....#...#.........#.#.....#.....#.#.#.#...#...# +#####.#.###.###.#.#.###.###.#.#.#.#.###.#############.###.#.#.###.#####.#.#.###.#######.###########.#####.#.###.#######.#.###.#.#.#.###.###.# +#.....#.#.......#.#...#.#...#.#.#...#...#.#.......#...#...#.#.#.#.........#...#.......#.........#.....#...#.#...#.....#.....#.#.#...#.....#.# +#.#####.#.#.#.###.###.#.#.###.#.###.#.###.#.#.###.#.###.###.#.#.#####.#######.#######.###.#####.###.#.#.###.#.#.#.###.###.#.#.#.###.#.#.#.#.# +#.#.....#.#...#.#...#...#...#.#.#.#.#.......#.#...#...#.#...#...#...#.......#.#.....#.........#.#.....#.....#.#...#.#.......#.#...#.#.#...#.# +#.###.#.#.#####.###.###.###.###.#.#.#.#####.#.#.###.#.#.#.#.###.#.#########.#.#.#.#.#########.#.#.###########.#####.#########.#.###.#.###.#.# +#...#.#.#.#.#.....#.#...#...#...#.#.#.....#.#.....#.#...#.#...#.#.#.......#...#.#.#.........#.#.#.......#.....#.............#...#...#.#.#.#.# +#.#.#.#.#.#.#.###.#.#.###.###.###.#.#####.###.###.#.#####.###.#.#.#.###.#.#####.#.#######.#.#.#.#.#####.#.#########.###########.#.#.#.#.#.#.# +#.#.#.#...#...#...#.#...#.#...#.#...#...#.....#.....#...#...#.#.#.#.#...#.#...........#.#.#.#...#...#.#.#.#.......#.............#.#...#...#.# +#.#.#.#####.###.#.#.###.#.#.###.#.###.#.#######.###.###.###.###.#.#.#.#####.#########.#.#.#.#####.#.#.#.#.#.#####.###########.#.#.#.#####.#.# +#.............#.#.#.#...#...#...#.#...#.#.....#.#.#...#...#.....#.#.#.......#.......#...#.............#...#...#.#.........#...#.#.#.....#.#.# +#.#.#.#.#.#####.#.#.###.#####.###.#.###.###.###.#.###.###.#######.#.#########.#####.#################.#######.#.#########.#.###.#.#.###.#.#.# +#.#.#.#.#.....#...#.................#.....#.#...#.....#.........#...#.....#...#.............#.....#...........#.....#...#.#.#.....#...#.#.#.# +###.#.#.#####.###.#########.#####.#######.#.#.###.#####.#######.###.#.#.###.###############.#.#.#.#.###########.#.###.#.#.#.#.#.###.#.#.#.#.# +#...#...#...#.........#...#.#.....#.....#...#.#.#.....#.......#...#...#.#...#.....#.......#...#...#...#...#.....#.....#.....#.#.....#.#.#.#.# +#.#######.#######.#####.#.###.###.#.###.#####.#.###.#.###.#.#.###.#####.#.#.#.###.#.#.#########.#####.#.#.###.#####.#######.#.#.#.#.#.#.#.#.# +#.....#.#.......#.#.....#.#...#.#.#.#.#.....#.#.#...#.#...#.#...#...#.#.#.....#...#.#.........#...#...#.#...#.#...#.......#.#.#.#.....#.#.#.# +#.###.#.#.#####.#.#.#####.#.###.#.#.#.#####.#.#.#.#.#.#.#.#####.###.#.#.#######.###.#######.#####.#####.###.#.#.#.#######.#.#.#.###.###.###.# +#.#.#.#.#...#.#...#...#.#.#.#...#...#...#...#...#.#...#.#.#...#.....#...#...#...#...#...#...#...#.....#...#.#.#.#.#.....#...#.....#...#...#.# +#.#.#.#.###.#.#######.#.#.#.#.#.#######.#.###.#.#.#.###.###.#.#####.#.#####.#.###.#####.#.###.#.#####.###.#.###.#.#.###.###.###.#.#.#####.#.# +#...#.#.#...#.......#...#...#.#.........#.....#.....#...#...#.....#.#.......#.#.#.....#.#.....#.....#.#...#.....#.#.#...#...#...#.#.#.....#.# +###.#.#.#.###.#.###.###.#############.#############.###.#.#######.#.#########.#.#####.#.###########.#.#.#########.#.#.###.#.#.#.#.###.#####.# +#...#.#...#.#.....#.#...#.#.........#.............#...#...#...#...#...........#.........#...#.....#.#...#...#...#...#.....#.#.#.#...#.......# +#####.#.###.#.###.###.###.#.#.#####.#######.#####.###.#####.#.#.###.###########.#######.###.#.###.#.#####.#.#.###########.#.#.#.###.#.####### +#.....#...#.....#...#.#.#...#.#...#...#.....#.#...#.#.#.....#.#...#.....#.......#...#.#...#.#.#.#.#.......#...#.........#.#.#.#.#...#...#...# +#.#######.#########.#.#.#.###.#.#.###.#.#####.#.###.#.#.#####.###.###.###.#####.#.#.#.###.#.#.#.#.#.###.#######.###.#####.#.###.#.#####.#.#.# +#...#...#...........#.#.#...#...#.......#.....#.#...#...#...#...#...#.#...#...#.#...#.....#.#.#.#.#...#.#...#...#...#.....#.....#.#.#...#.#.# +#.#.#.#.#.#.#########.#.###.###.#########.###.#.#.#######.#.###.###.#.#.###.#.###.#.###.###.#.#.#.###.###.#.#.###.#.#.#########.#.#.#.###.#.# +#.#...#.#.#.........#.#...#...#...#.....#...#.#.#.........#...#.#...#...#...#.....#...#...#.....#...#.#...#.....#.#.#.#.....#.#.#.....#.....# +#.#####.#.#######.#.#.###.###.###.#.###.###.###.#######.#####.#.#.#######.#.#########.###.#####.#.#.#.#.#########.#.#.#.###.#.#.#.#####.###.# +#.....#.#.......#.#.#...#...#...#.....#...#...#.#.......#.....#...#.....#.#.........#...#.....#.#.#.#.....#.......#.#...#...#...#.......#...# +#.#####.#######.#.#.###.###.###.#########.#.#.#.#.#####.#####.#####.###.#.#.###.#######.#.#.#.###.#.#####.#.#######.#####.#######.#######.#.# +#.#.....#.....#.#.#...#...#.....#.........#.#...#.#...#.#...#.#.....#.#...#.#.#.......#.#.........#...#.....#...#...#.#...#.....#.#...#...#.# +###.#######.###.#.###.###.#.#####.#########.#.###.###.#.#.#.#.#.#####.#####.#.#####.#.#.#############.#.#.###.#.#.###.#.###.###.#.#.#.#.###.# +#...............#.#...#...#.....#.#.#.......#.......#...#.#.#.#.#...#.....#.#.....#.#.#...#.........#.#.#.....#.#.#...#...#.#.#.#...#...#...# +#.###.#.#.###.###.#.###.#####.#.#.#.#.#######.#.###.#####.#.#.#.#.#.#.###.#.#.###.#.#####.#.#######.###.#.#.###.#.#.#.###.#.#.#.#####.####### +#.....#.#.....#...#...#.....#.#...#.#.....#...#.#...#.....#.#...#.#.#.#...#.#...#.#.....#.#...#.....#...#.#...#.#.#.#...#...#.#.....#.......# +#.#####.#.###########.#####.#.#####.#####.###.#.#.###.#####.#####.#.#.#.#.#.#.###.###.###.###.#####.#.###.###.###.#.#.#######.#####.#.#####.# +#.#.#...#.........#.....#...#.#.............#.#.#...#.#...#.#.....#...#.#.#.#.#.....#.............#...#.#.#.#...#.#.#.....#.......#.#.......# +#.#.#.#.#########.#.#####.###.#.#.#####.###.#.#.###.#.#.#.#.###########.#.#.###.###.#########.#.#.#####.#.#.###.#.#.###.#.###.#####.#.#####.# +#...#...#...#...#...#.....#...#.#.....#...#.#...#.#.#.#.#.#.......#.....#...#...#.....#.....#.#.#.#...........#...#...#.#...#.....#...#.#...# +#######.#.#.#.#.###.#.#####.#.#######.#.#.#.#.###.#.#.#.#########.#.###.#.###.###.#####.###.###.#.#.#############.#####.###.#.###.###.#.#.### +#.......#.#...#.....#.#...#.#.#.....#.#.#...#.....#.....#.........#.#.#.#.#...#...#.....#.#.....#.#.#.......#...#.......#.#.#...#.#.....#.#.# +#.#####.#.###.#######.#.#.###.#.###.#.#.#.###.###########.#.#######.#.#.#.#.#.#.###.#####.#######.###.#####.#.#.#######.#.#.###.#.#.#.###.#.# +#...................#...#.....#.#.....#.#.#.............#...........#...#.....#...#.............#...#.....#.#.#...#.....#.#.#...#.#.#.#...#.# +#.#.###.###.###.###.#########.#.###.#.###.#####.#######.#.#.#.###.#########.#####.#######.#.#.#.###.#####.#.#.###.###.#.#.#.#.###.#.#.#.###.# +#.....#.#...#...#.#.#.......#.#...#...#...#...#...#...#.#...#...#...........#.....#.#.....#.#.#.#.....#...#.....#.#...#...#.....#...#.#.#...# +#.###.#.#.###.###.#.#.###.#.#.#.#.#.###.###.#.###.#.#.#.###.###########.#.#.#.#####.#.#.###.#.#.#.###.#.#########.#.#########.#.#####.#.#.### +#.#.#.#.....#.....#.............#...#...#...#.....#.#...#...#.........#.#...#.#...#...................#.#.....#...#...........#.#...#.#.#...# +#.#.#.#.#####.#.#.#.###.#.#.#.#.###.#.###.###.#.#####.###.#.#.#######.###.#.#.#.#.#.#.#######.#####.#.#.#####.#.#########.#.#.#.#.#.#.#.#.#.# +#...#.#.....#...#.#.#...............#.#...#...#.#...#.#...#.#.....#.#...#.#.#.#.#.#.#.....#.....#...#...................#.#.#.#.#.#.#.#.#.#.# +###.#.#.###.#####.#.#.###.#.#.###.#.#.#.#.#.#.#.#.#.#.#.###.#####.#.###.#.#.#.#.#.#.#####.#####.#.###########.###.#.###.#.#.#.#.#.#.#.#.###.# +#.#.#...#.....#...#.....#.#.#...#.#...#.#...#.#.#.#.#...#.#...#.............#.............#.....#...#.......#...#.#.#...#.#.......#...#...#.# +#.#.#####.###.#.#########.#.#.#.#.#.#######.#.###.#.#####.#.#.#.###.#.#####.#######.#.#####.#######.#.#.###.###.#.#.#.#.#####.#####.#.###.#.# +#.#...#.......#.....#.#.....#.#.#.#.......#.......#.......................#.........#.#.....#...#...#.#.#.....#.#.#.#.#.#.......#...#.....#.# +#.###.#.###.#######.#.#.#####.#.#.#.#.###.#.#########.#####.#.#.#.#.#####.#.#########.#.#.###.#.#.###.#.###.#.#.#.#.#.###.###.#.#####.#####.# +#.........#.#.....#...#...............#...#.........#.#...#...#.#.#...#.#.....#.....#.#.#.#...#...#...#...#...#.#.#.#...#.....#...#...#.....# +#.#####.#.###.#.#####.###.#.###.###.###.###########.#.#.#.#####.###.#.#.#.#.#.#.###.#.#.#.#.#######.#####.#.###.#.#.#.#.#####.###.#.#######.# +#S......#.....#.........#.....#.........#...........#...#...........#...#...#.....#.....#.#.............#.......#.....#.........#...........# +############################################################################################################################################# diff --git a/2024/inputs/day17.txt b/2024/inputs/day17.txt new file mode 100644 index 0000000..2761d0c --- /dev/null +++ b/2024/inputs/day17.txt @@ -0,0 +1,5 @@ +Register A: 30899381 +Register B: 0 +Register C: 0 + +Program: 2,4,1,1,7,5,4,0,0,3,1,6,5,5,3,0 diff --git a/2024/inputs/tests/test_day16_ex1.txt b/2024/inputs/tests/test_day16_ex1.txt new file mode 100644 index 0000000..2c21676 --- /dev/null +++ b/2024/inputs/tests/test_day16_ex1.txt @@ -0,0 +1,15 @@ +############### +#.......#....E# +#.#.###.#.###.# +#.....#.#...#.# +#.###.#####.#.# +#.#.#.......#.# +#.#.#####.###.# +#...........#.# +###.#.#####.#.# +#...#.....#.#.# +#.#.#.###.#.#.# +#.....#...#.#.# +#.###.#.#.#.#.# +#S..#.....#...# +############### diff --git a/2024/inputs/tests/test_day16_ex2.txt b/2024/inputs/tests/test_day16_ex2.txt new file mode 100644 index 0000000..bc61c57 --- /dev/null +++ b/2024/inputs/tests/test_day16_ex2.txt @@ -0,0 +1,17 @@ +################# +#...#...#...#..E# +#.#.#.#.#.#.#.#.# +#.#.#.#...#...#.# +#.#.#.#.###.#.#.# +#...#.#.#.....#.# +#.#.#.#.#.#####.# +#.#...#.#.#.....# +#.#.#####.#.###.# +#.#.#.......#...# +#.#.###.#####.### +#.#.#...#.....#.# +#.#.#.#####.###.# +#.#.#.........#.# +#.#.#.#########.# +#S#.............# +################# diff --git a/2024/inputs/tests/test_day17.txt b/2024/inputs/tests/test_day17.txt new file mode 100644 index 0000000..f09839b --- /dev/null +++ b/2024/inputs/tests/test_day17.txt @@ -0,0 +1,5 @@ +Register A: 729 +Register B: 0 +Register C: 0 + +Program: 0,1,5,4,3,0 diff --git a/2024/python/pyproject.toml b/2024/python/pyproject.toml index f631414..cfed4d2 100644 --- a/2024/python/pyproject.toml +++ b/2024/python/pyproject.toml @@ -39,6 +39,8 @@ day12 = "grice_py_aoc_2024.day12.main:main" day13 = "grice_py_aoc_2024.day13.main:main" day14 = "grice_py_aoc_2024.day14.main:main" day15 = "grice_py_aoc_2024.day15.main:main" +day16 = "grice_py_aoc_2024.day16.main:main" +day17 = "grice_py_aoc_2024.day17.main:main" [tool.pytest.ini_options] addopts = "-ra -q" diff --git a/2024/python/src/grice_py_aoc_2024/day16/__init__.py b/2024/python/src/grice_py_aoc_2024/day16/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/2024/python/src/grice_py_aoc_2024/day16/main.py b/2024/python/src/grice_py_aoc_2024/day16/main.py new file mode 100644 index 0000000..883e4b5 --- /dev/null +++ b/2024/python/src/grice_py_aoc_2024/day16/main.py @@ -0,0 +1,37 @@ +from __future__ import annotations + +import time +from pathlib import Path + +DIR = Path(__file__).parent +FILE = DIR.parents[3] / "inputs" / f"{DIR.stem}.txt" + + +def part1(contents: str) -> int: + total = 0 + # TODO part 1 + return total + + +def part2(contents: str) -> int: + total = 0 + # TODO part 2 + return total + + +def main(): + contents = FILE.read_text() + + _start1 = time.perf_counter() + result1 = part1(contents=contents) + _delta1 = time.perf_counter() - _start1 + print(f">> Part 1: {result1} ({_delta1:.6f}s)") + + _start2 = time.perf_counter() + result2 = part2(contents=contents) + _delta2 = time.perf_counter() - _start2 + print(f">> Part 2: {result2} ({_delta2:.6f}s)") + + +if __name__ == "__main__": + main() diff --git a/2024/python/src/grice_py_aoc_2024/day16/test_day16.py b/2024/python/src/grice_py_aoc_2024/day16/test_day16.py new file mode 100644 index 0000000..75573a4 --- /dev/null +++ b/2024/python/src/grice_py_aoc_2024/day16/test_day16.py @@ -0,0 +1,35 @@ +from __future__ import annotations + +from pathlib import Path + +import pytest + +from .main import part1, part2 + +DIR = Path(__file__).parent +TEST_FILE_EX1 = DIR.parents[3] / "inputs/tests" / f"test_{DIR.stem}_ex1.txt" +TEST_FILE_EX2 = DIR.parents[3] / "inputs/tests" / f"test_{DIR.stem}_ex2.txt" +EXPECTED_PART_1_EX1 = 7_036 +EXPECTED_PART_1_EX2 = 11_048 +EXPECTED_PART_2 = 456 # TODO replace! + + +@pytest.mark.skip(reason=f"{DIR.stem} P1 incomplete") +@pytest.mark.parametrize( + "file, expected", + [ + (TEST_FILE_EX1, EXPECTED_PART_1_EX1), + (TEST_FILE_EX2, EXPECTED_PART_1_EX2), + ], +) +def test_part1(file: Path, expected: int): + contents = file.read_text() + result = part1(contents=contents) + assert result == expected + + +@pytest.mark.skip(reason=f"{DIR.stem} P2 incomplete") +def test_part2(): + contents = TEST_FILE_EX1.read_text() + result = part2(contents=contents) + assert result == EXPECTED_PART_2 diff --git a/2024/python/src/grice_py_aoc_2024/day17/__init__.py b/2024/python/src/grice_py_aoc_2024/day17/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/2024/python/src/grice_py_aoc_2024/day17/main.py b/2024/python/src/grice_py_aoc_2024/day17/main.py new file mode 100644 index 0000000..d2825d7 --- /dev/null +++ b/2024/python/src/grice_py_aoc_2024/day17/main.py @@ -0,0 +1,37 @@ +from __future__ import annotations + +import time +from pathlib import Path + +DIR = Path(__file__).parent +FILE = DIR.parents[3] / "inputs" / f"{DIR.stem}.txt" + + +def part1(contents: str) -> str: + result = "" + # TODO part 1 + return result + + +def part2(contents: str) -> str: + result = "" + # TODO part 2 + return result + + +def main(): + contents = FILE.read_text() + + _start1 = time.perf_counter() + result1 = part1(contents=contents) + _delta1 = time.perf_counter() - _start1 + print(f">> Part 1: {result1} ({_delta1:.6f}s)") + + _start2 = time.perf_counter() + result2 = part2(contents=contents) + _delta2 = time.perf_counter() - _start2 + print(f">> Part 2: {result2} ({_delta2:.6f}s)") + + +if __name__ == "__main__": + main() diff --git a/2024/python/src/grice_py_aoc_2024/day17/test_day17.py b/2024/python/src/grice_py_aoc_2024/day17/test_day17.py new file mode 100644 index 0000000..c5f5cee --- /dev/null +++ b/2024/python/src/grice_py_aoc_2024/day17/test_day17.py @@ -0,0 +1,26 @@ +from __future__ import annotations + +from pathlib import Path + +import pytest + +from .main import part1, part2 + +DIR = Path(__file__).parent +TEST_FILE = DIR.parents[3] / "inputs/tests" / f"test_{DIR.stem}.txt" +EXPECTED_PART_1 = "4,6,3,5,6,3,5,2,1,0" +EXPECTED_PART_2 = "456" # TODO replace! + + +@pytest.mark.skip(reason=f"{DIR.stem} P1 incomplete") +def test_part1(): + contents = TEST_FILE.read_text() + result = part1(contents=contents) + assert result == EXPECTED_PART_1 + + +@pytest.mark.skip(reason=f"{DIR.stem} P2 incomplete") +def test_part2(): + contents = TEST_FILE.read_text() + result = part2(contents=contents) + assert result == EXPECTED_PART_2