Skip to content

Commit 1b9e12a

Browse files
committed
refactor, rename, and add Day 16 start
1 parent 8ed8303 commit 1b9e12a

File tree

14 files changed

+188
-18
lines changed

14 files changed

+188
-18
lines changed

.idea/Advent-of-Code.iml

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

AoC_2024/Days/14.py renamed to aoc_2024/Days/14.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
from tqdm import tqdm
1414

15-
from AoC_2024.utils import Grid, Point
15+
from aoc_2024.utils import Grid, Point
1616

1717

1818
DEMO_INPUT = """

aoc_2024/Days/16.py

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
"""
2+
--- Day 16: Reindeer Maze ---
3+
4+
Link:
5+
https://adventofcode.com/2024/day/16
6+
7+
"""
8+
import math
9+
from collections import defaultdict
10+
from enum import Enum, auto
11+
from pathlib import Path
12+
from sys import argv
13+
14+
from aoc_2024.maze import Maze
15+
from aoc_2024.utils import Grid, Point
16+
17+
18+
DEMO_INPUT = """
19+
###############
20+
#.......#....E#
21+
#.#.###.#.###.#
22+
#.....#.#...#.#
23+
#.###.#####.#.#
24+
#.#.#.......#.#
25+
#.#.#####.###.#
26+
#...........#.#
27+
###.#.#####.#.#
28+
#...#.....#.#.#
29+
#.#.#.###.#.#.#
30+
#.....#...#.#.#
31+
#.###.#.#.#.#.#
32+
#S..#.....#...#
33+
###############
34+
"""
35+
36+
37+
def remap(_map: str) -> Maze:
38+
"""
39+
Remap example list input provided in "Advent of Code"
40+
format.
41+
"""
42+
return Maze(_map)
43+
44+
45+
def part_1(maze: Maze):
46+
maze.visualize()
47+
48+
49+
def part_2(maze: Maze):
50+
...
51+
52+
53+
def solve(input_file=None):
54+
if input_file:
55+
demo = False
56+
default = ' '
57+
print(f"Solving with input file {input_file}")
58+
try:
59+
INPUT = open(input_file).read()
60+
except FileNotFoundError:
61+
print('File not found, using default ...')
62+
INPUT = open(Path(__file__).parent.parent / 'Inputs' / '14').read()
63+
_width = 101
64+
_height = 103
65+
66+
else:
67+
demo = True
68+
default = '.'
69+
INPUT = DEMO_INPUT
70+
71+
print("Solving Day 16 Problem! 🎄")
72+
73+
maze = remap(INPUT)
74+
75+
# Part 1
76+
_result = part_1(maze)
77+
print('Part 1:', _result)
78+
79+
# Part 2
80+
# _result = part_2(maze)
81+
# print('Part 2:', _result)
82+
83+
84+
if __name__ == '__main__':
85+
solve()
File renamed without changes.

0 commit comments

Comments
 (0)