This commit is contained in:
barmal4 2021-04-27 21:34:05 +02:00
parent a4c1164962
commit 5a10d66131
4 changed files with 7 additions and 7 deletions

View File

@ -96,7 +96,6 @@ class Game:
def findBomb(self):
# return BfsPathFinder(self.board).findBomb(State(self.agent.getOrientation(),Point(self.agent.getPoint().getX(),self.agent.getPoint().getY())))
point = self.board.bombMap.popitem()
return PathFinder(self.board).findBomb(State(self.agent.getOrientation(),Point(self.agent.getPoint().getX(),self.agent.getPoint().getY())))

View File

@ -23,21 +23,22 @@ class PathFinder(BfsPathFinder):
cameFrom = dict()
cameFrom[x] = None
while not self.openList:
while self.openList:
current = self.minKey(self.fScore, self.openList)
if self.checkGoal(current):
return self.constructActions(current, startState)
self.openList.remove(current)
for next in self.getNeighbour(current):
tentativeGScore = self.gScore.get(self.current) + current.state.getPoint().distance(next.state.getPoint())
tentativeGScore = self.gScore.get(current) + current.state.getPoint().distance(next.state.getPoint())
if tentativeGScore < self.gScore.get(next, 10000):
cameFrom[next] = current
self.cameFrom[next] = current
next.parent = current
self.gScore[next] = tentativeGScore
self.fScore[next] = next.state.getPoint().distance(startState.getPoint())
if next not in self.openList:
self.openList.append(next)
if next not in self.openList:
self.openList.append(next)
return []