gameanalysis.matgame module

module for complete independent games

gameanalysis.matgame.matgame(payoff_matrix)[source]

Create a game from a dense matrix with default names

Parameters

payoff_matrix (ndarray-like) – The matrix of payoffs for an asymmetric game.

gameanalysis.matgame.matgame_copy(copy_game)[source]

Copy a matrix game from an existing game

Parameters

copy_game (RsGame) – Game to copy payoff data out of. This game must be complete.

gameanalysis.matgame.matgame_json(json)[source]

Read a matrix game from json

In general, the json will have ‘type’: ‘matrix…’ to indicate that it’s a matrix game, but if the other fields are correct, this will still succeed.

gameanalysis.matgame.matgame_names(role_names, strat_names, payoff_matrix)[source]

Create a game from a payoff matrix with names

Parameters
  • role_names ([str]) – The name of each role.

  • strat_names ([[str]]) – The name of each strategy for each role.

  • payoff_matrix (ndarray-like) – The matrix mapping strategy indices to payoffs for each player.

gameanalysis.matgame.matgame_replace(base, payoff_matrix)[source]

Replace an existing game with a new payoff matrix

Parameters
  • base (RsGame) – Game to take structure out of.

  • payoff_matrix (ndarray-like) – The new payoff matrix.