Skip to content

Commit 9072e12

Browse files
committed
Rename the CoordinatesParser and Map to append a C for complex
1 parent 7ddf56f commit 9072e12

19 files changed

Lines changed: 136 additions & 21 deletions

File tree

advent_of_code/2017/d19.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ class Day19(aoc.Challenge):
2828
aoc.TestCase(part=1, inputs=SAMPLE, want="ABCDEF"),
2929
aoc.TestCase(part=2, inputs=SAMPLE, want=38),
3030
]
31-
INPUT_PARSER = aoc.CoordinatesParser(ignore=" ")
31+
INPUT_PARSER = aoc.CoordinatesParserC(ignore=" ")
3232

3333
def solver(self, puzzle_input: dict[complex, str], part_one: bool) -> int | str:
3434
"""Walk the maze and track steps/letters."""

advent_of_code/2017/d22.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ class Day22(aoc.Challenge):
1515
INPUT_PARSER = aoc.ParseMultiple(
1616
[
1717
aoc.Transform(lambda x: len(x.splitlines())),
18-
aoc.CoordinatesParser(origin_top_left=False),
18+
aoc.CoordinatesParserC(origin_top_left=False),
1919
]
2020
)
2121
TESTS = [

advent_of_code/2018/d13.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ def solver(self, puzzle_input: InputType, part_one: bool) -> str:
9696

9797
def input_parser(self, puzzle_input: str) -> InputType:
9898
"""Parse the input data."""
99-
parsed = aoc.CoordinatesParser().parse(puzzle_input)
99+
parsed = aoc.CoordinatesParserC().parse(puzzle_input)
100100
junctions = parsed.coords.get("+", set())
101101
turns = {coord: CORNERS[char] for char in "/\\" for coord in parsed.coords.get(char, [])}
102102
wagons_directions = {coord: direction for char, direction in DIRECTIONS.items() for coord in parsed.coords.get(char, [])}

advent_of_code/2018/d15.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ def simulate(self, spaces: set[complex], units_by_type: dict[str, dict[complex,
170170

171171
def input_parser(self, puzzle_input: str) -> InputType:
172172
"""Parse the input data."""
173-
data = aoc.CoordinatesParser().parse(puzzle_input)
173+
data = aoc.CoordinatesParserC().parse(puzzle_input)
174174
spaces = data - "#"
175175
units = {
176176
unit_type: {

advent_of_code/2018/d18.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ class Day18(aoc.Challenge):
2727
aoc.TestCase(part=1, inputs=SAMPLE, want=1147),
2828
aoc.TestCase(part=2, inputs=SAMPLE, want=aoc.TEST_SKIP),
2929
]
30-
INPUT_PARSER = aoc.CoordinatesParser(chars=None, origin_top_left=True)
30+
INPUT_PARSER = aoc.CoordinatesParserC(chars=None, origin_top_left=True)
3131

3232
def solver(self, puzzle_input: aoc.Map, part_one: bool) -> int:
3333
area = typing.cast(frozendict.frozendict[complex, str], frozendict.frozendict(puzzle_input.chars))

advent_of_code/2019/d18.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ def solve_for(self, starts: list[str], edges: dict[str, dict[str, tuple[int, int
164164

165165
def solver(self, puzzle_input: str, part_one: bool) -> int:
166166
if not part_one:
167-
data = aoc.CoordinatesParser(ignore=None, origin_top_left=True).parse(puzzle_input)
167+
data = aoc.CoordinatesParserC(ignore=None, origin_top_left=True).parse(puzzle_input)
168168

169169
center = data.coords["@"].copy().pop()
170170
data.update(center, "#")
@@ -177,7 +177,7 @@ def solver(self, puzzle_input: str, part_one: bool) -> int:
177177
typing.cast(dict[complex, str], data.chars), data.max_y + 1, data.max_x + 1
178178
)
179179

180-
data = aoc.CoordinatesParser(ignore="#", origin_top_left=True).parse(puzzle_input)
180+
data = aoc.CoordinatesParserC(ignore="#", origin_top_left=True).parse(puzzle_input)
181181
starts = list("@" if part_one else "0123")
182182
nodes: dict[str, complex] = {
183183
char: pos

advent_of_code/2019/d20.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ class Day20(aoc.Challenge):
114114
aoc.TestCase(part=1, inputs=SAMPLE[1], want=58),
115115
aoc.TestCase(part=2, inputs=SAMPLE[2], want=396),
116116
]
117-
INPUT_PARSER = aoc.CoordinatesParser()
117+
INPUT_PARSER = aoc.CoordinatesParserC()
118118

119119
def get_portals(self, puzzle_input: aoc.Map, part_one: bool) -> dict[str, list[tuple[complex, int]]]:
120120
"""Return a map of all the portals (their positions and in/out direction)."""

advent_of_code/2021/d09.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ class Day09(aoc.Challenge):
2020
aoc.TestCase(inputs=SAMPLE[0], part=1, want=15),
2121
aoc.TestCase(inputs=SAMPLE[0], part=2, want=1134),
2222
)
23-
INPUT_PARSER = aoc.CoordinatesParser()
23+
INPUT_PARSER = aoc.CoordinatesParserC()
2424

2525
@classmethod
2626
def lows(cls, depths: aoc.Map) -> list[complex]:

advent_of_code/2021/d15.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ def part2(self, puzzle_input: aoc.Map) -> int:
5555
)
5656
for y in range(graph.height * 5)
5757
]
58-
graph = aoc.CoordinatesParser().parse("\n".join(rows))
58+
graph = aoc.CoordinatesParserC().parse("\n".join(rows))
5959
return self.solve(graph)
6060

6161
@staticmethod

advent_of_code/2022/d12.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ def part2(self, puzzle_input: InputType) -> int:
6161

6262
def input_parser(self, puzzle_input: str) -> InputType:
6363
"""Parse the input data."""
64-
parser = aoc.CoordinatesParser()
64+
parser = aoc.CoordinatesParserC()
6565
data = parser.parse(puzzle_input)
6666
start = data["S"].pop()
6767
end = data["E"].pop()

0 commit comments

Comments
 (0)