Luna Lailatova
2 years ago
2 changed files with 2039 additions and 0 deletions
@ -0,0 +1,39 @@ |
|||||||
|
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': |
||||||
|
|
Loading…
Reference in new issue