Represents the generic (expected) result of an action.
This class functions as a simple wrapper around a boolean representing the success (True) or failure (False) of the (expected) mutation of an
matrx.actions.action.Action, as well as the reason for it.
matrx.actions.action.ActionResultclass contains several generic reasons for a succeed or fail as constant class attributes.
The super-class whose children return an ActionResult
Both the methods
matrx.actions.Action.mutate()should return an
matrx.actions.action.ActionResult. With the former it represents the expected success or failure of the
matrx.actions.action.Action, with the latter the actual success or failure.
IDLE_ACTION: Always given when an AgentBrain decided upon returning None (the idle action)
AGENT_WAS_REMOVED: Always given when an agent does not exist anymore in the GridWorld.
AGENT_NOT_CAPABLE: Always given when the Action an AgentBrain decided upon is not an Action that agent should be capable of.
UNKNOWN_ACTION: Always given when the Action name an AgentBrain decided upon is not recognized as a class name of an Action or some class inheriting from Action. Could be caused by either that class not existing or because it is never imported anywhere (and hence is not on the path the GridWorld searches in).
When creating a new
matrx.actions.action.Actionclass, you can also extend this class with your own. This allows you to set your own constants representing reasons for that
matrx.actions.action.Actionspecific results. This allows an
matrx.agents.agent_brain.AgentBrainto directly match the
matrx.actions.ActionResult.resultwith a constant and potentially adjust its behavior.
__init__(self, result, succeeded)¶
Initialize self. See help(type(self)) for accurate signature.
__init__(self, result, succeeded)
Result when the agent is not capable of performing that action.
Result when the action is not expected to succeed.
Result when the action name does not represent an
Result when the action succeeded or is expected to succeed.
Result string for when the agent was removed before performing its action.
Deprecated: Use IDLE_ACTION instead.