egttools.behaviors.CRD.CRDMemoryOnePlayer¶
- class CRDMemoryOnePlayer(self: egttools.numerical.numerical_.behaviors.CRD.CRDMemoryOnePlayer, personal_threshold: SupportsInt | SupportsIndex, initial_action: SupportsInt | SupportsIndex, action_above: SupportsInt | SupportsIndex, action_equal: SupportsInt | SupportsIndex, action_below: SupportsInt | SupportsIndex)¶
Bases:
AbstractCRDStrategyMemory-one strategy for collective-risk dilemma games.
Construct a memory-one strategy for a collective-risk dilemma.
The strategy contributes initial_action in the first round. In later rounds, it compares the sum of contributions of the other group members in the previous round to personal_threshold.
if the previous group contribution is greater than personal_threshold, the player chooses action_above;
if it is equal to personal_threshold, the player chooses action_equal;
if it is smaller than personal_threshold, the player chooses action_below.
- Parameters:
personal_threshold (int) – Threshold against which the previous group contribution is compared.
initial_action (int) – Contribution in the first round.
action_above (int) – Contribution used when the previous group contribution is above the threshold.
action_equal (int) – Contribution used when the previous group contribution equals the threshold.
action_below (int) – Contribution used when the previous group contribution is below the threshold.
See also
egttools.behaviors.CRD.AbstractCRDStrategy,egttools.games.CRDGame,egttools.games.CRDGameTUMethods
Return the action chosen by the strategy.
Return the strategy type.
- __init__(self: egttools.numerical.numerical_.behaviors.CRD.CRDMemoryOnePlayer, personal_threshold: SupportsInt | SupportsIndex, initial_action: SupportsInt | SupportsIndex, action_above: SupportsInt | SupportsIndex, action_equal: SupportsInt | SupportsIndex, action_below: SupportsInt | SupportsIndex) None¶
Construct a memory-one strategy for a collective-risk dilemma.
The strategy contributes initial_action in the first round. In later rounds, it compares the sum of contributions of the other group members in the previous round to personal_threshold.
if the previous group contribution is greater than personal_threshold, the player chooses action_above;
if it is equal to personal_threshold, the player chooses action_equal;
if it is smaller than personal_threshold, the player chooses action_below.
- Parameters:
personal_threshold (int) – Threshold against which the previous group contribution is compared.
initial_action (int) – Contribution in the first round.
action_above (int) – Contribution used when the previous group contribution is above the threshold.
action_equal (int) – Contribution used when the previous group contribution equals the threshold.
action_below (int) – Contribution used when the previous group contribution is below the threshold.
- __new__(**kwargs)¶
- get_action(self: egttools.numerical.numerical_.behaviors.CRD.CRDMemoryOnePlayer, time_step: SupportsInt | SupportsIndex, group_contributions_prev: SupportsInt | SupportsIndex) int¶
Return the action chosen by the strategy.
- Parameters:
- Returns:
Action selected by the strategy.
- Return type:
Examples
>>> from egttools.behaviors.CRD import CRDMemoryOnePlayer >>> strategy = CRDMemoryOnePlayer(4, 2, 4, 2, 0) >>> strategy.get_action(0, 0) 2
- type(self: egttools.numerical.numerical_.behaviors.CRD.CRDMemoryOnePlayer) str¶
Return the strategy type.
- __annotations__ = {}¶