Base Player

A collection of player classes.

Includes:
  • Player

  • FixedPolicyPlayer

class imperfecto.algos.player.Player(name='')[source]

Bases: abc.ABC

An abstract player class.

name

The name of the player.

Type

str

strategy

map from instostate to np.array of shape (n_actions,).

Type

dict

act(infostate)[source]

Returns the action to take given an infostate.

Parameters

infostate (str) – The infostate to take the action in.

Return type

int

Returns

The action to take.

abstract update_strategy(history, player_id)[source]

Update the strategy of the player at the end of the game.

Parameters
  • history (Sequence[Enum]) – The history of the game, which must be a terminal node.

  • player_id (int) – The id of the player to update (i.e., my id).

Return type

None

property game
property strategy

A dict with key = infostate and value = np.array of shape (n_actions,).

class imperfecto.algos.player.NormalFormPlayer(name='')[source]

Bases: imperfecto.algos.player.Player, abc.ABC

property strategy

A np.array of shape (n_actions,).

act(infostate)[source]

Returns the action to take given an infostate.

Parameters

infostate (str) – The infostate to take the action in.

Return type

int

Returns

The action to take.

class imperfecto.algos.player.FixedPolicyPlayer(name, strategy)[source]

Bases: imperfecto.algos.player.Player

A player with a given fixed strategy.

Parameters
  • name (str) – The name of the player.

  • strategy (dict) – The fixed strategy of the player.

name

The name of the player.

Type

str

strategy

The fixed strategy of the player.

Type

dict

update_strategy(history, player_id)[source]

Update the strategy of the player at the end of the game.

Parameters
  • history (Sequence[Enum]) – The history of the game, which must be a terminal node.

  • player_id (int) – The id of the player to update (i.e., my id).

Return type

None