Module pacai.agents.search.corners
Expand source code
from pacai.agents.search.base import SearchAgent
from pacai.core.search import search
from pacai.student import searchAgents
class AStarCornersAgent(SearchAgent):
"""
A search agent for `pacai.student.searchAgents.CornersProblem` using A*
and `pacai.student.searchAgents.cornersHeuristic`.
"""
def __init__(self, index, **kwargs):
super().__init__(index, **kwargs)
self.searchFunction = lambda prob: search.astar(prob, searchAgents.cornersHeuristic)
self.searchType = searchAgents.CornersProblem
Classes
class AStarCornersAgent (index, **kwargs)
-
A search agent for
CornersProblem
using A* andcornersHeuristic()
.Expand source code
class AStarCornersAgent(SearchAgent): """ A search agent for `pacai.student.searchAgents.CornersProblem` using A* and `pacai.student.searchAgents.cornersHeuristic`. """ def __init__(self, index, **kwargs): super().__init__(index, **kwargs) self.searchFunction = lambda prob: search.astar(prob, searchAgents.cornersHeuristic) self.searchType = searchAgents.CornersProblem
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 …