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 Cooperation

  • strategy (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

get_action

Returns an action in function of time_step round and the previous action action_prev of the opponent.

is_stochastic

Property indicating if the strategy is stochastic.

type

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 Cooperation

  • strategy (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)
__str__()[source]

Return str(self).

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
  • time_step (int) – Current round.

  • action_prev (int) – Previous action of the opponent.

Returns

The action selected by the strategy.

Return type

int

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.