egttools.behaviors.NormalForm.TwoActions.Detective

class Detective[source]

Bases: AbstractNFGStrategy

A Detective player who tries to analyze the opponent.

This player will always play the same initial sequence of Cooperate, Defect, Cooperate, Cooperate. If the opponent defects during this initial sequence, then Defective will play TFT from the 5th round on. Otherwise, Detective will play always Defect.

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__()[source]

A Detective player who tries to analyze the opponent.

This player will always play the same initial sequence of Cooperate, Defect, Cooperate, Cooperate. If the opponent defects during this initial sequence, then Defective will play TFT from the 5th round on. Otherwise, Detective will play always Defect.

__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.