Module pacai.agents.search.multiagent
Expand source code
from pacai.agents.base import BaseAgent
from pacai.util import reflection
class MultiAgentSearchAgent(BaseAgent):
"""
A common class for all multi-agent searchers.
"""
def __init__(self, index, evalFn = 'pacai.core.eval.score', depth = 2, **kwargs):
super().__init__(index, **kwargs)
self._evaluationFunction = reflection.qualifiedImport(evalFn)
self._treeDepth = int(depth)
def getEvaluationFunction(self):
return self._evaluationFunction
def getTreeDepth(self):
return self._treeDepth
Classes
class MultiAgentSearchAgent (index, evalFn='pacai.core.eval.score', depth=2, **kwargs)
-
A common class for all multi-agent searchers.
Expand source code
class MultiAgentSearchAgent(BaseAgent): """ A common class for all multi-agent searchers. """ def __init__(self, index, evalFn = 'pacai.core.eval.score', depth = 2, **kwargs): super().__init__(index, **kwargs) self._evaluationFunction = reflection.qualifiedImport(evalFn) self._treeDepth = int(depth) def getEvaluationFunction(self): return self._evaluationFunction def getTreeDepth(self): return self._treeDepth
Ancestors
- BaseAgent
- abc.ABC
Subclasses
Static methods
def loadAgent(name, index, args={})
-
Inherited from:
BaseAgent
.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:
BaseAgent
.final
Inform the agent about the result of a game.
def getAction(self, state)
-
Inherited from:
BaseAgent
.getAction
The BaseAgent will receive an
AbstractGameState
, and must return an action fromDirections
. def getEvaluationFunction(self)
-
Expand source code
def getEvaluationFunction(self): return self._evaluationFunction
def getTreeDepth(self)
-
Expand source code
def getTreeDepth(self): return self._treeDepth
def observationFunction(self, state)
-
Inherited from:
BaseAgent
.observationFunction
Make an observation on the state of the game. Called once for each round of the game.
def registerInitialState(self, state)
-
Inherited from:
BaseAgent
.registerInitialState
Inspect the starting state.