terminal putput fix
This commit is contained in:
parent
bd7a7881b2
commit
37aca9f70e
@ -31,7 +31,7 @@ def a_path(table, start, end, obstacles):
|
||||
# Loop until you find the end
|
||||
i = 0
|
||||
while len(open_list) > 0:
|
||||
print(i)
|
||||
#print(i)
|
||||
i = i + 1
|
||||
current_node = open_list[0]
|
||||
current_index = 0
|
||||
|
@ -83,20 +83,22 @@ class Window():
|
||||
self.grid.draw_node(self.screen, path[index-1][0],path[index-1][1])
|
||||
self.grid.draw_node(self.screen, x, y)
|
||||
pg.time.delay(500)
|
||||
print("collected:",grid.table[x][y].house.trash[2],"on possition: (",x,",",y,") ", grid.table[x][y].house.trash_file)
|
||||
|
||||
|
||||
#visit all points from from to_collect
|
||||
|
||||
for ind, x in enumerate(to_collect):
|
||||
#copy table
|
||||
obs = [3,8,6,7]
|
||||
if ind == 0:
|
||||
array = [[self.grid.table[col][row] for row in range(cols)] for col in range(rows)]
|
||||
path = a_path(array,(start[0],start[1]),(x[0],x[1]),obs)
|
||||
print("Path:",path)
|
||||
#print("Path:",path)
|
||||
else:
|
||||
array = [[self.grid.table[col][row] for row in range(cols)] for col in range(rows)]
|
||||
path = a_path(array,(to_collect[ind-1][0],to_collect[ind-1][1]),(x[0],x[1]),obs)
|
||||
print("Path:",path)
|
||||
#print("Path:",path)
|
||||
|
||||
|
||||
#draw movement of garbage truck
|
||||
@ -106,7 +108,7 @@ class Window():
|
||||
#last move
|
||||
array = [[self.grid.table[col][row] for row in range(cols)] for col in range(rows)]
|
||||
path = a_path(array,(to_collect[len(to_collect)-1][0],to_collect[len(to_collect)-1][1]),(end[0],end[1]),obs)
|
||||
print("Path:",path)
|
||||
#print("Path:",path)
|
||||
move_truck(path)
|
||||
|
||||
pg.quit() # pylint: disable=no-member
|
||||
|
Loading…
Reference in New Issue
Block a user