Compare commits
No commits in common. "aaca415d2b7cf1c875f209a00c203b03e0e846b3" and "ee28498264c1a027ba7935ba7ab8989231c39546" have entirely different histories.
aaca415d2b
...
ee28498264
@ -78,83 +78,62 @@ while not found:
|
||||
x = cur[1]
|
||||
|
||||
sub_found = False
|
||||
#print('Start: ' + str(cur) + ' ' + wall(cur))
|
||||
print('Start: ' + str(cur) + ' ' + wall(cur))
|
||||
|
||||
dirc = ''
|
||||
|
||||
#print('Trying to find way')
|
||||
#print('Previous is ' + str(prev) + wall(prev))
|
||||
print('Trying to find way')
|
||||
print('Previous is ' + str(prev) + wall(prev))
|
||||
if y+1 < len(grid[0]) and not sub_found:
|
||||
#print('Can go right')
|
||||
# Right
|
||||
new = (list(cur)[0]+1,list(cur)[1])
|
||||
#print(wall(new))
|
||||
if grid[x][y+1] in ('─','┐','┘') and new != prev:
|
||||
#print('Trying Right')
|
||||
#print('prev: ' + str(prev) + ' cur: ' + str(cur) + ' new: ' + str(new))
|
||||
print('Trying Right')
|
||||
print('prev: ' + str(prev) + ' cur: ' + str(cur) + ' new: ' + str(new))
|
||||
dirc = 'R'
|
||||
if wall(cur) in ('─','┌','└','S'):
|
||||
if wall(new) == 'S':
|
||||
print('Found')
|
||||
found = True
|
||||
#print('Went Right')
|
||||
print('Went Right')
|
||||
prev = (y,x)
|
||||
y += 1
|
||||
print(wall(new))
|
||||
sub_found = True
|
||||
else:
|
||||
print('Cant go right cus ' + str(y) + ' < ' + str(len(grid)))
|
||||
|
||||
if y > 0 and not sub_found:
|
||||
#print('Can go left')
|
||||
# Left
|
||||
new = (list(cur)[0]-1,list(cur)[1])
|
||||
if grid[x][y-1] in ('─','┌','└') and new != prev:
|
||||
#print('Trying Left')
|
||||
#print('prev: ' + str(prev) + ' cur: ' + str(cur) + ' new: ' + str(new))
|
||||
print('Trying Left')
|
||||
print('prev: ' + str(prev) + ' cur: ' + str(cur) + ' new: ' + str(new))
|
||||
dirc = 'L'
|
||||
if wall(cur) in ('─','┐','┘','S'):
|
||||
if wall(new) == 'S':
|
||||
print('Found')
|
||||
found = True
|
||||
#print('Went Left')
|
||||
prev = (y,x)
|
||||
print('Went Left')
|
||||
y -= 1
|
||||
print(wall(new))
|
||||
sub_found = True
|
||||
else:
|
||||
print('Cant go left cus ' + str(y) + ' > ' + str(0))
|
||||
|
||||
if x > 0 and not sub_found:
|
||||
print('Can go up')
|
||||
# Up
|
||||
new = (list(cur)[0],list(cur)[1]-1)
|
||||
#print(wall(new))
|
||||
if grid[x-1][y] in ('│','┌','┐','S') and new != prev:
|
||||
if grid[x-1][y] in ('│','┌','┐') and new != prev:
|
||||
print('Trying Up')
|
||||
print('prev: ' + str(prev) + ' cur: ' + str(cur) + ' new: ' + str(new))
|
||||
dirc = 'U'
|
||||
|
||||
if wall(cur) in ('│','└','┘','S'):
|
||||
print('Went Up')
|
||||
if wall(new) == 'S':
|
||||
print('Found')
|
||||
found = True
|
||||
prev = (y,x)
|
||||
x -=1
|
||||
sub_found = True
|
||||
|
||||
if x < len(grid) and not sub_found:
|
||||
#print('Can go down')
|
||||
# Down
|
||||
new = (list(cur)[0],list(cur)[1]+1)
|
||||
#print(wall(new))
|
||||
if grid[x+1][y] in ('│','└','┘','S') and new != prev:
|
||||
#print('Trying Down')
|
||||
#print('prev: ' + str(prev) + ' cur: ' + str(cur) + ' new: ' + str(new))
|
||||
if grid[x+1][y] in ('│','└','┘') and new != prev:
|
||||
print('Trying Down')
|
||||
print('prev: ' + str(prev) + ' cur: ' + str(cur) + ' new: ' + str(new))
|
||||
dirc = 'D'
|
||||
if wall(cur) in ('│','┌','┐','S'):
|
||||
#print('Went Down')
|
||||
if wall(new) == 'S':
|
||||
print('Found')
|
||||
found = True
|
||||
prev = (y,x)
|
||||
print('Went Down')
|
||||
x += 1
|
||||
sub_found = True
|
||||
|
||||
@ -162,13 +141,13 @@ while not found:
|
||||
cur = (y,x)
|
||||
|
||||
steps.append((x,y))
|
||||
p(grid,steps)
|
||||
print('Going ' + dirc + ' to ' + str(cur) + ' ' + wall(cur))
|
||||
print('Previous is ' + str(prev) + ' ' + wall(prev))
|
||||
p(grid,steps)
|
||||
print()
|
||||
input()
|
||||
count += 1
|
||||
#print(cur, start)
|
||||
p(grid,steps)
|
||||
if cur == start:
|
||||
found = True
|
||||
|
||||
print(count)
|
||||
print(count/2)
|
||||
|
@ -1,5 +0,0 @@
|
||||
..F.F7.
|
||||
.7.FJ|.
|
||||
.|SJ.L7
|
||||
..|F--J
|
||||
..LJ...
|
@ -1,5 +0,0 @@
|
||||
7..F.F7.
|
||||
J.7.FJ|.
|
||||
F.|SJJ.L7
|
||||
L..|F--J
|
||||
...LJL..
|
@ -1,5 +0,0 @@
|
||||
7..F.F7.
|
||||
J.F--JL7
|
||||
F.LS.J.|7
|
||||
L..|F--J
|
||||
...LJL..
|
@ -1,5 +0,0 @@
|
||||
..F.F7.
|
||||
.7.FJ|.
|
||||
.|S---7
|
||||
..|F--J
|
||||
..LJ...
|
@ -1,7 +0,0 @@
|
||||
.....---
|
||||
...F--7.
|
||||
F7SJ..|.
|
||||
..F-7||.
|
||||
..|.L-J.
|
||||
..L7....
|
||||
........
|
Loading…
Reference in New Issue
Block a user