diff --git a/Engine/Game.py b/Engine/Game.py index 4d847334..f611adae 100644 --- a/Engine/Game.py +++ b/Engine/Game.py @@ -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()))) diff --git a/Engine/PathFinder.py b/Engine/PathFinder.py index c55d3322..c701d0cf 100644 --- a/Engine/PathFinder.py +++ b/Engine/PathFinder.py @@ -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 [] diff --git a/Engine/__pycache__/Game.cpython-39.pyc b/Engine/__pycache__/Game.cpython-39.pyc index 07b79109..c5463636 100644 Binary files a/Engine/__pycache__/Game.cpython-39.pyc and b/Engine/__pycache__/Game.cpython-39.pyc differ diff --git a/Engine/__pycache__/PathFinder.cpython-39.pyc b/Engine/__pycache__/PathFinder.cpython-39.pyc index 476583d6..f9c5ebc4 100644 Binary files a/Engine/__pycache__/PathFinder.cpython-39.pyc and b/Engine/__pycache__/PathFinder.cpython-39.pyc differ