You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
39 lines
958 B
39 lines
958 B
def expandGrid(direct): |
|
if direct == "U": |
|
gridVisited.append(0, []) |
|
for _ in range(len(gridVisited[1])) |
|
gridVisited[0].append('.') |
|
elif direct == "R" |
|
for i in range(len(gridVisited)) |
|
gridVisited[i].append('.') |
|
elif direct == "D" |
|
gridVisited.append([]) |
|
tempx = len(gridVisited) - 1 |
|
for _ in range(len(gridVisited[0])) |
|
gridVisited[tempx].append('.') |
|
elif direct == "L" |
|
for i in range(len(gridVisited)) |
|
gridVisited[i].append('.') |
|
|
|
gridVisited =[['#']] |
|
posHead = |
|
posTail = |
|
|
|
with open('input9.txt','r') as f: |
|
inp = f.read().splitlines(keepends=False) |
|
|
|
direction = [] |
|
distance = [] |
|
|
|
for i in inp: |
|
tempa, tempb = i.split(' ') |
|
direction.append(tempa) |
|
distance.append(tempb) |
|
|
|
for x in range(len(direction)): |
|
if direction[x] == 'U': |
|
|
|
elif direction[x] == 'R': |
|
elif direction[x] == 'D': |
|
elif direction[x] == 'L': |
|
|