import numpy as np
with open('data-2024-18.txt', 'r') as f:
inp = f.read().splitlines()
bytes = [[int(x.split(',')[0]), int(x.split(',')[1])] for x in inp]Advent of Code 2024 Day 18
— Day 18: RAM Run —
You are inside a computer, with bytes falling down.
Simulate the first kilobyte (1024 bytes) falling onto your memory space. Afterward, what is the minimum number of steps needed to reach the exit?
Create a grid, fill that grid with first bunch of corruption.
p1_bytes = bytes[:1024]
ram = np.full((71,71), '.')
for p in p1_bytes:
ram[p[0],p[1]] = '#'
np.savetxt('ram_bytes.txt', ram, delimiter='', fmt='%s')How do I now solve for shortest path?