modified: main.py
This commit is contained in:
parent
de3ecc0926
commit
bf1ac0349d
12
main.py
12
main.py
@ -206,7 +206,7 @@ graph ={}
|
|||||||
for y, row in enumerate(grid):
|
for y, row in enumerate(grid):
|
||||||
for x, col in enumerate(row):
|
for x, col in enumerate(row):
|
||||||
graph[(x, y)] = graph.get((x, y), []) + get_neighbours(x, y)
|
graph[(x, y)] = graph.get((x, y), []) + get_neighbours(x, y)
|
||||||
print("graph 2 0",graph[(2,0)])
|
#print("graph 2 0",graph[(2,0)])
|
||||||
|
|
||||||
start = (1,1)
|
start = (1,1)
|
||||||
goal =(0,5)
|
goal =(0,5)
|
||||||
@ -223,11 +223,11 @@ while goall==1:
|
|||||||
path=[]
|
path=[]
|
||||||
path_head, path_segment = goal, goal
|
path_head, path_segment = goal, goal
|
||||||
while path_segment:
|
while path_segment:
|
||||||
print("path_segment: ",path_segment)
|
# print("path_segment: ",path_segment)
|
||||||
|
|
||||||
path_segment =visited[path_segment]
|
path_segment =visited[path_segment]
|
||||||
path.append(path_segment)
|
path.append(path_segment)
|
||||||
print("path_head",path_head)
|
#print("path_head",path_head)
|
||||||
path.pop(len(path)-1)
|
path.pop(len(path)-1)
|
||||||
path.reverse()
|
path.reverse()
|
||||||
path_true=[]
|
path_true=[]
|
||||||
@ -236,15 +236,15 @@ bfss =Bfs(Game)
|
|||||||
|
|
||||||
for i in path:
|
for i in path:
|
||||||
z=str(i)
|
z=str(i)
|
||||||
print("Z:",z)
|
#print("Z:",z)
|
||||||
x=z[1]
|
x=z[1]
|
||||||
y=z[4]
|
y=z[4]
|
||||||
x=int(x)*64
|
x=int(x)*64
|
||||||
y=int(y)*64
|
y=int(y)*64
|
||||||
a=bfss.get_cell_number(x,y)
|
a=bfss.get_cell_number(x,y)
|
||||||
path_true.append(a)
|
path_true.append(a)
|
||||||
print("path:",path)
|
#print("path:",path)
|
||||||
print("path_true:",path_true)
|
#print("path_true:",path_true)
|
||||||
#bfss.move_agent(path_true)
|
#bfss.move_agent(path_true)
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user