This causes the garbage truck to sometimes move through already visited dumpsters to move more quickly. The garbage truck firstly visitis all houses and then visits the garbage dump
To implement A star we have used tuples and a priority queue. We start with an `openlist` with our starting node and cost of the node and then we add more nodes that are possible to visit to that list. If it did not find anything in `openlist` then it would mean that there is no target, but in our case that cannot happen. If the current node we are visiting is our goal then it means that we are done and can retrace our path. `openlist` represents nodes that are possible to visit.
```
while openlist!={}:
current = openlist.get()
if current == goal:
path = []
#following from the succesors to the root our starting point
while current != start:
path.append(current)
current = origin[current]
path.reverse()
break
# succescor function
for succ in neighbors(current):
#checking if didn't go out of the maze
if(succ[0] <0orsucc[1]<0orsucc[0]> 19 or succ[1] > 19):
Our successor function goes through the neighbors. Firstly it checks whether the neighbor is in fact in the grid or if it is outside. If it is outside then we skip it. Then we calculate the g(the distance between our starting node and the current node). If the node has not been already visited or if it has a lower g cost then f, then we add it to the closed list. Change the predecessor, reassign fscore as gscore and calculate the priority. At the end we add it to `openlist`. Then we repeat for the next neighbor until all of them are visited(if possible).