Add day4 part1 solution
This commit is contained in:
parent
16d8f293eb
commit
2491ef0518
140
day4/input.txt
Normal file
140
day4/input.txt
Normal file
|
@ -0,0 +1,140 @@
|
||||||
|
ASAMXXXXSSMMSMAXSAXXXMAMXAMXMMAMXMMMMSSMMMMMMMMMSMXSASXSMXMMMXAMSSSMSSXMXMASMSMMMSMASXMMMAMXMXMMXSXMASMSMXMASMXSMXMAMXMMSMSASAMXSXMAMSAMXSSS
|
||||||
|
SAMXSXXMAAAAXMXSAMXSMXMSSXXAMMAMAMXMAMASMAMAXMAMXAXSAXAXAASAMSAMAAAAAAASXMASMSAXAAXAMAMXMMXSSMMSAMXSXAAAAASAMXAMASXMASXAAAXASMSMSAAAXXAXXMAM
|
||||||
|
MAMAAAMAXSMMMMXSAXMAMAMMAMSMMSXSASMMMSAMXAXMSSXSMMMMMMSMSMSAMSAMMXMMMMASAMAMXSAMSSMMSMSMSMAMXAXMASAMXMSMXMSMXMXMAMAMASMMMSMMMAAAMXMAMMSMAMAM
|
||||||
|
SAMXSSXSMMMSAMASXMMASAMSAMAMXMAMMMXAMMASXSSMAMAAXXAAAMAAXXMMMSXMXSXAAXAMXMAMAMXMXAMXAAAAAMAMMSMMSAMXAMAMSMXMAMAMAXAMXMAAAXAAMMMMMXMAMSAMXSMS
|
||||||
|
MXMAMAAAXAAMAMMMMXSAMMXSMSXSAAMSMSMMMXASAMXMAXSMMXSMSSMSSMXMASMXXAMMMMSSXSASMMMASXMMMSMSMSXSAMAXXAXMXXASAMAXAXAMMMSXXXMMSSSMXSASASMSMAAXMAXA
|
||||||
|
XSAMXMSMMMSXXMASMMMSSMAMXXXSXSXAXAAAMMXMMMXMXXAAXMMAMXXAAMMMXSASXMAXXAXXASAXAAXMXMXSAMXAAXXMASMXSSMSSSXSAMXSSSMMSAMASMMAAAAAASMAAXAAMMMASXMS
|
||||||
|
MSASXXXASAMMXMAAXAAMXMSSSMAXAMMMSXSMSAMMSSMMMASAAAMAMMMSSMASMMAMXXMSMSSMAS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AAAAAAAXSXX
|
||||||
|
AXAAAXXSMMXMAAAMAMSMMAAAMSMSMAXSAMAAMSAMXSAAXMXSXMAXAMAMAMSMMMMMAAMMXMAAASMMMSMMMAMAASMMSASXSAMAMASMSMAMMSXMXXXMMMMMMMMAMSXMMMMSSSMMMSMMMAAA
|
||||||
|
SSSSMSAMXSASMSMMASMAXSMMMASAMXMSASXSASAMXMMMXSAMXSAXMMAMXMASXXXXSAMMSMSSMSAXAAXAMMMMMMAASMMMSASMMAXAAAAAAAXSXXSAAAAAAMMSMAMSXMAAMAXAAXASAMSM
|
||||||
|
MAAAAMAMAMAMXAASXMMAMXXXSXSXSAASAMAMMSXMXSMAAMASAMXSXSSSMAXXMMXXMAAASAAMAMXMSSSXSXASAMXMMAAASXMXMMMSMSSSMMSAAMSSSSSSMSAAMASXAMMSSMMMXSXMSXAX
|
||||||
|
MSMMMMMXAMAMMSMMAMMSXMAMMMSMSAXMMMAMXXMAMXMAMSAMAXXXMAXSAXMAXSASXSMASMMSSMAAXAXMSXSMSAMXSSMXSAAXXMAMAXAXASAMXMXAXMXXXMXSSMSMXMMAAXAXXMASXSSS
|
76
day4/run.py
76
day4/run.py
|
@ -24,7 +24,7 @@ class FindXMAS:
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def _part1(self) -> int:
|
def _part1(self) -> int:
|
||||||
pass
|
return len(self.locate_xmas())
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def _part2(self) -> None:
|
def _part2(self) -> None:
|
||||||
|
@ -34,56 +34,52 @@ class FindXMAS:
|
||||||
def _to_grid(input: str) -> List[List[str]]:
|
def _to_grid(input: str) -> List[List[str]]:
|
||||||
return [list(line) for line in input.splitlines() if line]
|
return [list(line) for line in input.splitlines() if line]
|
||||||
|
|
||||||
def _find_neighbours(
|
def find_neighbours(
|
||||||
self,
|
self,
|
||||||
origin: Tuple[int, int],
|
origin: Tuple[int, int],
|
||||||
bounds: Tuple[Tuple[int, int], ...] = ((-1, 1), (-1, 1)),
|
|
||||||
locations: Tuple[Tuple[int, ...]] = (),
|
|
||||||
target: str = "XMAS",
|
target: str = "XMAS",
|
||||||
) -> Tuple[int, ...]:
|
) -> List[Tuple[Tuple[int, ...]]]:
|
||||||
if len(target) <= 1:
|
locations: List[Tuple[Tuple[int, ...]]] = []
|
||||||
return locations
|
x, y = origin
|
||||||
current = self.inputgrid[origin[0]][origin[1]]
|
if self.inputgrid[x][y].upper() != target[0].upper():
|
||||||
next = target[target.find(current) + 1]
|
return []
|
||||||
for row in range(origin[0] + bounds[0][0], origin[0] + bounds[0][1] + 1):
|
for dx in range(-1, 2):
|
||||||
for col in range(origin[1] - bounds[1][0], origin[1] + bounds[1][1] + 1):
|
for dy in range(-1, 2):
|
||||||
if any(
|
if dx == 0 and dy == 0:
|
||||||
(
|
|
||||||
row < 0,
|
|
||||||
row >= len(self.inputgrid[0]),
|
|
||||||
col < 0,
|
|
||||||
col >= len(self.inputgrid),
|
|
||||||
)
|
|
||||||
):
|
|
||||||
continue
|
continue
|
||||||
if self.inputgrid[row][col].upper() == next.upper():
|
current = [(x, y)]
|
||||||
return self._find_neighbours(
|
for n in range(1, len(target)):
|
||||||
origin=(row, col),
|
nx = x + (n * dx)
|
||||||
bounds=(
|
ny = y + (n * dy)
|
||||||
(-1 if row < origin[0] else 0, 1 if row > origin[0] else 0),
|
if nx < 0 or ny < 0:
|
||||||
(-1 if col < origin[1] else 0, 1 if col > origin[1] else 0),
|
continue
|
||||||
),
|
try:
|
||||||
locations=(
|
if self.inputgrid[nx][ny].upper() == target[n].upper():
|
||||||
locations,
|
current.append((nx, ny))
|
||||||
(row, col),
|
except IndexError:
|
||||||
),
|
pass
|
||||||
target=target[1:],
|
if len(current) == 4:
|
||||||
)
|
locations.append(tuple(current))
|
||||||
|
return locations
|
||||||
|
|
||||||
def locate_xmas(self) -> List[Tuple[int, int, int, int]]:
|
def locate_xmas(self) -> List[Tuple[Tuple[int, ...]]]:
|
||||||
location: List[Tuple[int, ...]] = []
|
locations: List[Tuple[Tuple[int, ...]]] = []
|
||||||
|
|
||||||
for i, line in enumerate(self.inputgrid):
|
for i, line in enumerate(self.inputgrid):
|
||||||
for j, char in enumerate(line):
|
for j, char in enumerate(line):
|
||||||
if char.upper() == "X":
|
if char.upper() == "X":
|
||||||
location.append(self._find_neighbours((i, j), target="XMAS"))
|
neighbours = self.find_neighbours((i, j), target="XMAS")
|
||||||
|
if neighbours is None:
|
||||||
|
continue
|
||||||
|
locations = [*locations, *neighbours]
|
||||||
|
|
||||||
return location
|
return locations
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
example = FindXMAS(EXAMPLE)
|
example = FindXMAS(EXAMPLE)
|
||||||
print(example._find_neighbours((0, 4)))
|
print(example)
|
||||||
print(example.locate_xmas())
|
assert example._part1 == 18
|
||||||
# print(example)
|
with open("input.txt", "r") as f:
|
||||||
# assert example._part1 == 18
|
puzzle = FindXMAS(f.read())
|
||||||
|
print(puzzle)
|
||||||
|
|
Loading…
Reference in a new issue