Module pacai.agents.search.foodsearch
Expand source code
from pacai.agents.search.base import SearchAgent
from pacai.core.search import search
from pacai.core.search.food import FoodSearchProblem
from pacai.student import searchAgents
class AStarFoodSearchAgent(SearchAgent):
"""
A search agent for `pacai.core.search.food.FoodSearchProblem using A*
and `pacai.student.searchAgents.foodHeuristic`.
"""
def __init__(self, index, **kwargs):
super().__init__(index, **kwargs)
self.searchFunction = lambda prob: search.astar(prob, searchAgents.foodHeuristic)
self.searchType = FoodSearchProblem
Classes
class AStarFoodSearchAgent (index, **kwargs)
-
A search agent for
pacai.core.search.food.FoodSearchProblem using A* and
pacai.student.searchAgents.foodHeuristic`.Expand source code
class AStarFoodSearchAgent(SearchAgent): """ A search agent for `pacai.core.search.food.FoodSearchProblem using A* and `pacai.student.searchAgents.foodHeuristic`. """ def __init__(self, index, **kwargs): super().__init__(index, **kwargs) self.searchFunction = lambda prob: search.astar(prob, searchAgents.foodHeuristic) self.searchType = FoodSearchProblem
Ancestors
- SearchAgent
- BaseAgent
- abc.ABC
Static methods
def loadAgent(name, index, args={})
-
Inherited from:
SearchAgent
.loadAgent
Load an agent with the given class name. The name can be fully qualified or just the bare class name. If the bare name is given, the class should …
Methods
def final(self, state)
-
Inherited from:
SearchAgent
.final
Inform the agent about the result of a game.
def getAction(self, state)
-
Inherited from:
SearchAgent
.getAction
Returns the next action in the path chosen earlier (in registerInitialState). Return Directions.STOP if there is no further action to take.
def observationFunction(self, state)
-
Inherited from:
SearchAgent
.observationFunction
Make an observation on the state of the game. Called once for each round of the game.
def registerInitialState(self, state)
-
Inherited from:
SearchAgent
.registerInitialState
This is the first time that the agent sees the layout of the game board. Here, we choose a path to the goal. In this phase, the agent should compute …