tiddying up

This commit is contained in:
Daniel Weber 2024-12-18 06:43:37 -05:00
parent ae6c6b05c1
commit d050a1a6b3

View File

@ -25,38 +25,24 @@ def part_one(input):
while True: while True:
keys = list(G.keys()) keys = list(G.keys())
keys.sort() keys.sort()
print("G", G)
p_list = G.pop(keys[0]) p_list = G.pop(keys[0])
p = p_list[-1] p = p_list[-1]
for x in [[1,0],[-1,0],[0,1],[0,-1]]: for x in [[1,0],[-1,0],[0,1],[0,-1]]:
nx = add(x,p) nx = add(x,p)
if nx == END: if nx == END:
print("WE FOUND THE END", len(p_list)) print("P1: ", len(p_list))
return return
print(V)
if grid_check(nx, input) and tuple(nx) not in V: if grid_check(nx, input) and tuple(nx) not in V:
h = tuple([mag(sub(END, nx)), *nx]) h = tuple([mag(sub(END, nx)), *nx])
V.add(tuple(nx)) V.add(tuple(nx))
G[h] = [*p_list, nx] G[h] = [*p_list, nx]
# if []
pass
def part_two(input): def part_two(input):
pass pass
def main(): def main():
f = open(INPUTS[0], 'r') f = open(INPUTS[0], 'r')
contents = [list(map(int, x.strip().split(","))) for x in f.readlines()] contents = [list(map(int, x.strip().split(","))) for x in f.readlines()]
print(contents[:INPUTS[2]])
part_one(contents[:INPUTS[2]]) part_one(contents[:INPUTS[2]])
part_two(contents[:INPUTS[2]]) part_two(contents[:INPUTS[2]])