day4 part1
This commit is contained in:
parent
2e0241fde8
commit
2bcab64eff
140
2024/full/day04.txt
Normal file
140
2024/full/day04.txt
Normal file
@ -0,0 +1,140 @@
|
|||||||
|
MMASXSSXSAMXSMMMMSMMXXSXMASAMXSMMSAMXSSSMMMXAAXMASMSMSMXSSSSMSMSMMSMSMASMSAMXXSMMXAMXXXXMMSSSXMSSMSSXMASMMSSSMSMXMXMAXMAMXXXXSXSSMMSSMXASMXM
|
||||||
|
XXAMXAXAXXMAMAASXMXSAXXAXXMASAMXMMAMAMXAAAAASMXSMAAAAAXSMAMXAAXAAXXAAAXMXSMAXMAMXASMMSMSAAAXMAMMAAASMXMXAMAMAAAMASAMXMASMSSMMMAMAASAMXSSSMMS
|
||||||
|
MMXSAMMMMSMASXMSAAAMMMSMMXMAMASMMSSMMSSSMMSMXAASMMAMMMMXMAMMSMSSSMMSMSMSAMXXSMASMAMSAAASMMMXXAMSMMMMXAMMMMASMSMSASASXMAMAAAAMMSMSMMAMXMASAAA
|
||||||
|
XMAMAXMAAXXASAAXMMMSMAXMAXMASXMAXAXAXMAMXAXMMMMMAXMXMSASAASAAAXMAXMASAAMMSSMMMAMMAMAMMMMSMMASMMSAMXXSXSAXXMSAAAMAXAMXSMMMMSXSAMAAXMAMMMXMMMS
|
||||||
|
MMSXSMSMSSMSSMMMSSMAMASASXMAXAMSMASXMMMMMMAXMXMSXMXAMXAAAMMXSXMSXMSMSMSMAAMAAMAXMXSMMMXAASMAXMASMSMXMASXSMASMMSMXMAMASAXSXAAMASMMMMMXAMAXXAX
|
||||||
|
MAXXMAMSAXMASAAAAASXSASAMAMSXSXAAMXMXSAAASMSMAMMMSSMSMXMMMXAMAXMMASASAMMMMMSMXMMMXXXMMMSMSMSSMMMAXMASMMAMMAMAXMASMXMASAMXMMMMAMXXMASXSSMSMSS
|
||||||
|
MAMAMMMMMSMASMMMXXAXMXMAXSXXAXMASMAMMAMSXSAAXAXAAXAMAMXXSXMASMMAXXMMMAMXAMXMSAAASMMMS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
|
MXXXMSMSMSSSSSMMSMAMXSAXMXXMAAAXAAXSXMAMMAMASMXSAMAAAMMSMMXSMSMSXMAMSMAAXXMASXMXMSXSXMAMXSXMAMMMMMMMMMMSXAMAMAAMAMAAMMMMSMXSAXXAMXSAXXAAXMAS
|
||||||
|
SSXSAAASAMAAMXAAMMSSXMASMAAMSSSMSSXMSMAMSAMXSMMMAMMSMMXAMAMXAAAMMXAMAMMMSMSASMAAMSAMMMSAMXMSXXAAAAAXAAAMMSSMMMSASMMXSAMXMAMAMMMSAMXAAMMMXSAM
|
||||||
|
AAAMMMSMAMMXMMMMSAXMASAAMXMAAAAXAMXAASAMSAMXMXASAMAAASXSMSASMMSMASXSASAAAXMASMSAMXAMAAMAMXMASMSSSSSSMMXSAMSXAXMMMAAASXSAAAXAMXXMASMSMXMSAMXS
|
||||||
|
MMMMXMAXAMXXMASMMXMXMAMSAMXXMSMMMAMSMSSMSXMSMSXSXSSSSMAXXAMXMXXXMAMMXSMSSSMMMAMXSSXMMSSSMSMASXXXXMAAXAAMXMXMASXXSMMMSXSASASXSXAMSAAAXSXMASMA
|
39
2024/python/day04.py
Normal file
39
2024/python/day04.py
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
import matrix
|
||||||
|
import shared
|
||||||
|
from collections import Counter
|
||||||
|
|
||||||
|
# XMAS = ['X','M','A','S']
|
||||||
|
XMAS = "XMAS"
|
||||||
|
|
||||||
|
|
||||||
|
# @shared.profile
|
||||||
|
def part1(mx):
|
||||||
|
count = 0
|
||||||
|
for idr, row in enumerate(mx):
|
||||||
|
for idc, c in enumerate(row):
|
||||||
|
los = matrix.line_of_sight(mx, idr, idc, distance=4, diagonals=True)
|
||||||
|
words = list(map("".join, los.values()))
|
||||||
|
counter = Counter(words)
|
||||||
|
count += counter[XMAS]
|
||||||
|
print(count)
|
||||||
|
|
||||||
|
|
||||||
|
# @shared.profile
|
||||||
|
def part2(rows):
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
def main():
|
||||||
|
mx = matrix.load_matrix_file(shared.get_fname(4), str)
|
||||||
|
with shared.elapsed_timer() as elapsed:
|
||||||
|
part1(mx)
|
||||||
|
print("🕒", elapsed())
|
||||||
|
|
||||||
|
rows = [row for row in shared.load_rows(4, True)]
|
||||||
|
with shared.elapsed_timer() as elapsed:
|
||||||
|
part2(rows)
|
||||||
|
print("🕒", elapsed())
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
main()
|
@ -186,6 +186,7 @@ def get_neighbor_coords(matrix, c, r, diagonals=True):
|
|||||||
pass # okay we out of bounds boizzzz
|
pass # okay we out of bounds boizzzz
|
||||||
return neighbors
|
return neighbors
|
||||||
|
|
||||||
|
|
||||||
def get_neighbors_cardinal(matrix, c, r, diagonals=True):
|
def get_neighbors_cardinal(matrix, c, r, diagonals=True):
|
||||||
height = len(matrix)
|
height = len(matrix)
|
||||||
width = len(matrix[0])
|
width = len(matrix[0])
|
||||||
@ -199,14 +200,17 @@ def get_neighbors_cardinal(matrix, c, r, diagonals=True):
|
|||||||
try:
|
try:
|
||||||
value = matrix[r + _r][c + _c] # Try to get a value error
|
value = matrix[r + _r][c + _c] # Try to get a value error
|
||||||
if r + _r >= 0 and c + _c >= 0:
|
if r + _r >= 0 and c + _c >= 0:
|
||||||
neighbors[CARDINALS[coord]] = {"c": c + _c, "r": r + _r, "value":value} # woo, no error, this coord is valid
|
neighbors[CARDINALS[coord]] = {
|
||||||
|
"c": c + _c,
|
||||||
|
"r": r + _r,
|
||||||
|
"value": value,
|
||||||
|
} # woo, no error, this coord is valid
|
||||||
except IndexError:
|
except IndexError:
|
||||||
pass # okay we out of bounds boizzzz
|
pass # okay we out of bounds boizzzz
|
||||||
return neighbors
|
return neighbors
|
||||||
|
|
||||||
|
|
||||||
|
def line_of_sight_coords_diagonals(
|
||||||
def line_of_sight_coords(
|
|
||||||
matrix, row, col, distance=None
|
matrix, row, col, distance=None
|
||||||
) -> Dict[str, List[Tuple[int, int]]]:
|
) -> Dict[str, List[Tuple[int, int]]]:
|
||||||
"""
|
"""
|
||||||
@ -221,37 +225,112 @@ def line_of_sight_coords(
|
|||||||
col_ids = list(range(0, height))
|
col_ids = list(range(0, height))
|
||||||
row_ids = list(range(0, width))
|
row_ids = list(range(0, width))
|
||||||
|
|
||||||
|
directions = {
|
||||||
|
"UR": [],
|
||||||
|
"UL": [],
|
||||||
|
"DR": [],
|
||||||
|
"DL": []
|
||||||
|
}
|
||||||
|
ur = False
|
||||||
|
ul = False
|
||||||
|
dl = False
|
||||||
|
dr = False
|
||||||
|
|
||||||
|
# Boundaries of the grid
|
||||||
|
max_row, max_col = height, width
|
||||||
|
|
||||||
|
# Up-right (decrease row, increase column)
|
||||||
|
r, c = row, col
|
||||||
|
while r > 0 and c < max_col - 1:
|
||||||
|
ur = True
|
||||||
|
r -= 1
|
||||||
|
c += 1
|
||||||
|
directions["UR"].append((r, c))
|
||||||
|
|
||||||
|
# Up-left (decrease row, decrease column)
|
||||||
|
r, c = row, col
|
||||||
|
while r > 0 and c > 0:
|
||||||
|
ul = True
|
||||||
|
r -= 1
|
||||||
|
c -= 1
|
||||||
|
directions["UL"].append((r, c))
|
||||||
|
|
||||||
|
# Down-right (increase row, increase column)
|
||||||
|
r, c = row, col
|
||||||
|
while r < max_row - 1 and c < max_col - 1:
|
||||||
|
dr = True
|
||||||
|
r += 1
|
||||||
|
c += 1
|
||||||
|
directions["DR"].append((r, c))
|
||||||
|
|
||||||
|
# Down-left (increase row, decrease column)
|
||||||
|
r, c = row, col
|
||||||
|
while r < max_row - 1 and c > 0:
|
||||||
|
dl = True
|
||||||
|
r += 1
|
||||||
|
c -= 1
|
||||||
|
directions["DL"].append((r, c))
|
||||||
|
|
||||||
if distance:
|
if distance:
|
||||||
up_ids, down_ids = (
|
for _dir in ["DL", "UL", "DR", "UR"]:
|
||||||
list(reversed(col_ids[:col])),
|
directions[_dir] = directions[_dir][:distance - 1]
|
||||||
col_ids[col + 1 : col + distance + 1],
|
if directions[_dir]:
|
||||||
)
|
directions[_dir].insert(0, (row,col))
|
||||||
left_ids, right_ids = (
|
return directions
|
||||||
list(reversed(row_ids[:row])),
|
|
||||||
row_ids[row + 1 : row + distance + 1],
|
|
||||||
)
|
def line_of_sight_coords(
|
||||||
|
matrix, row, col, distance=None, diagonals=False
|
||||||
|
) -> Dict[str, List[Tuple[int, int]]]:
|
||||||
|
"""
|
||||||
|
Takes a matrix, a row, and a column
|
||||||
|
calculates the coordinates to the edge for all four cardinal directions
|
||||||
|
|
||||||
|
returns a dict with a list of tuple coordes TRAVELING AWAY from the
|
||||||
|
requested coordinate
|
||||||
|
"""
|
||||||
|
height, width = get_size(matrix)
|
||||||
|
|
||||||
|
col_ids = list(range(0, height))
|
||||||
|
row_ids = list(range(0, width))
|
||||||
|
|
||||||
|
up_ids = list(reversed(col_ids[:col]))
|
||||||
|
down_ids = col_ids[col + 1 :]
|
||||||
|
left_ids = list(reversed(row_ids[:row]))
|
||||||
|
right_ids = row_ids[row + 1 :]
|
||||||
|
|
||||||
|
if distance:
|
||||||
|
left = [(r, col) for r in left_ids[:distance - 1]]
|
||||||
|
right = [(r, col) for r in right_ids[:distance - 1]]
|
||||||
|
up = [(row, c) for c in up_ids[:distance - 1]]
|
||||||
|
down = [(row, c) for c in down_ids[:distance - 1]]
|
||||||
|
left.insert(0, (row, col))
|
||||||
|
right.insert(0, (row, col))
|
||||||
|
down.insert(0, (row, col))
|
||||||
|
up.insert(0, (row, col))
|
||||||
else:
|
else:
|
||||||
up_ids, down_ids = list(reversed(col_ids[:col])), col_ids[col + 1 :]
|
left = [(r, col) for r in left_ids]
|
||||||
left_ids, right_ids = list(reversed(row_ids[:row])), row_ids[row + 1 :]
|
right = [(r, col) for r in right_ids]
|
||||||
|
up = [(row, c) for c in up_ids]
|
||||||
|
down = [(row, c) for c in down_ids]
|
||||||
|
|
||||||
left = [(r, col) for r in left_ids]
|
directions = {
|
||||||
right = [(r, col) for r in right_ids]
|
|
||||||
up = [(row, c) for c in up_ids]
|
|
||||||
down = [(row, c) for c in down_ids]
|
|
||||||
|
|
||||||
return {
|
|
||||||
"U": up,
|
"U": up,
|
||||||
"L": left,
|
"L": left,
|
||||||
"D": down,
|
"D": down,
|
||||||
"R": right,
|
"R": right,
|
||||||
}
|
}
|
||||||
|
if diagonals:
|
||||||
|
vals = line_of_sight_coords_diagonals(matrix, row, col, distance)
|
||||||
|
directions.update(vals)
|
||||||
|
return directions
|
||||||
|
|
||||||
|
|
||||||
def line_of_sight(mx, row, col, distance=None):
|
def line_of_sight(mx, row, col, distance=None, diagonals=False):
|
||||||
"""
|
"""
|
||||||
renders a line of sight coord calculation, into the values
|
renders a line of sight coord calculation, into the values
|
||||||
"""
|
"""
|
||||||
coords = line_of_sight_coords(mx, row, col, distance)
|
coords = line_of_sight_coords(mx, row, col, distance, diagonals)
|
||||||
los = defaultdict(list)
|
los = defaultdict(list)
|
||||||
for k, ids in coords.items():
|
for k, ids in coords.items():
|
||||||
for _row, _col in ids:
|
for _row, _col in ids:
|
||||||
|
10
2024/samples/day04.txt
Normal file
10
2024/samples/day04.txt
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
MMMSXXMASM
|
||||||
|
MSAMXMSMSA
|
||||||
|
AMXSXMAAMM
|
||||||
|
MSAMASMSMX
|
||||||
|
XMASAMXAMM
|
||||||
|
XXAMMXXAMA
|
||||||
|
SMSMSASXSS
|
||||||
|
SAXAMASAAA
|
||||||
|
MAMMMXMMMM
|
||||||
|
MXMXAXMASX
|
Loading…
Reference in New Issue
Block a user