egttools.behaviors.NormalForm.TwoActions.MemoryOneStrategy¶
- class MemoryOneStrategy(action_first_round, strategy, is_stochastic)[source]¶
Bases:
AbstractNFGStrategy
Defines a Memory One strategy.
- Parameters
action_first_round (Union[int, float]) – Indicates the action this strategy will play in the first round. In the case that
is_stochastic
is True, then this value should be a probability of Cooperationstrategy (Union[Dict[Tuple[int, int], int], Dict[Tuple[int, int], float]]) – A dictionary with tuples defining the action/probability of cooperation for each pair of previous actions of self and the opponent, e.g., CC, DC….
is_stochastic (bool) – Indicates whether the strategy is stochastic or not. If it is stochastic, then the values both for the
action_first_round
and the strategy should be probabilities of Cooperation. If it is False, then 1 - indicates Cooperation and 0 - indicates Defection.
Methods
Returns an action in function of time_step round and the previous action action_prev of the opponent.
Property indicating if the strategy is stochastic.
Returns a string indicating the Strategy Type.
- __init__(action_first_round, strategy, is_stochastic)[source]¶
Defines a Memory One strategy.
- Parameters
action_first_round (Union[int, float]) – Indicates the action this strategy will play in the first round. In the case that
is_stochastic
is True, then this value should be a probability of Cooperationstrategy (Union[Dict[Tuple[int, int], int], Dict[Tuple[int, int], float]]) – A dictionary with tuples defining the action/probability of cooperation for each pair of previous actions of self and the opponent, e.g., CC, DC….
is_stochastic (bool) – Indicates whether the strategy is stochastic or not. If it is stochastic, then the values both for the
action_first_round
and the strategy should be probabilities of Cooperation. If it is False, then 1 - indicates Cooperation and 0 - indicates Defection.
- __new__(**kwargs)¶
- get_action(time_step, action_prev)[source]¶
Returns an action in function of time_step round and the previous action action_prev of the opponent.
- Parameters
- Returns
The action selected by the strategy.
- Return type
See also
egttools.behaviors.NormalForm.TwoActions.Cooperator
,egttools.behaviors.NormalForm.TwoActions.Defector
,egttools.behaviors.NormalForm.TwoActions.Random
,egttools.behaviors.NormalForm.TwoActions.TFT
,egttools.behaviors.NormalForm.TwoActions.SuspiciousTFT
,egttools.behaviors.NormalForm.TwoActions.GenerousTFT
,egttools.behaviors.NormalForm.TwoActions.GradualTFT
,egttools.behaviors.NormalForm.TwoActions.ImperfectTFT
,egttools.behaviors.NormalForm.TwoActions.TFTT
,egttools.behaviors.NormalForm.TwoActions.TTFT
,egttools.behaviors.NormalForm.TwoActions.GRIM
,egttools.behaviors.NormalForm.TwoActions.Pavlov
- is_stochastic(self: egttools.numerical.numerical.behaviors.NormalForm.AbstractNFGStrategy) bool [source]¶
Property indicating if the strategy is stochastic.
- type(self: egttools.numerical.numerical.behaviors.NormalForm.AbstractNFGStrategy) str [source]¶
Returns a string indicating the Strategy Type.