pygambit.gambit.StrategicGame#

class pygambit.gambit.StrategicGame#

A Game with a strategic (payoff table) representation.

Constructing StrategicGame(dim, title) creates a new game with a strategic representation. Players are labeled "1", "2", and so on; each player’s strategies are likewise labeled "1", "2", and so on.

Changed in version 16.1.0: Added the title parameter.

Changed in version 17.0.0: Replaces Game.new_table.

Parameters:
  • dim (array-like) – A list specifying the number of strategies for each player.

  • title (str, optional) – The title of the game. If no title is specified, “Untitled strategic game” is used.

Methods

from_arrays(*arrays[, title])

Create a new strategic game from payoff arrays.

from_dict(payoffs[, title])

Create a new strategic game from a dict of payoff arrays.

get_max_payoff(player)

Returns the largest payoff for player in any play of the game.

get_min_payoff(player)

Returns the smallest payoff for player in any play of the game.

get_outcome(location)

Returns the label of the outcome attached at location.

get_outcome_payoffs(label)

Returns the payoff to each player at the outcome labeled label.

get_outcomes()

Returns the labels of the outcomes in the game.

get_payoffs(contingency)

Returns the payoff to each player at a pure-strategy contingency.

get_strategies(player)

Returns a snapshot of the labels of the strategies belonging to player.

has_perfect_recall(player)

Returns whether player has perfect recall.

make_outcome(location, payoffs, label)

Create an outcome with payoffs and label and attach it at location.

make_outcome_null(location)

Reset the outcome at location to the null outcome.

mixed_strategy_profile([data, rational])

Create a mixed strategy profile over the game.

random_strategy_profile([denom, gen])

Create a MixedStrategy on the game, with probabilities drawn from the uniform distribution over the set of mixed strategy profiles.

relabel_outcomes(labels[, strict])

Simultaneously reassign the labels of the game's outcomes.

relabel_players(labels[, strict])

Simultaneously reassign the labels of the game's players.

relabel_strategies(player, labels[, strict])

Simultaneously reassign the labels of player's strategies.

set_outcome_payoffs(label, payoffs)

Sets the payoff to each player at the outcome labeled label.

set_players(players[, drop, add])

Set the players of the game to be players, matching by label.

set_strategies(player, strategies[, drop, add])

Set the strategies of player to be strategies, matching by label.

strategy_support_profile([strategies])

Create a new StrategySupportProfile on the game.

to_arrays(dtype)

Generate the payoff tables for players represented as numpy arrays.

to_efg([filepath_or_buffer])

Save the game to an .efg file or return its serialized representation

to_html([filepath_or_buffer])

Export the game to HTML format.

to_latex([filepath_or_buffer])

Export the game to LaTeX format.

to_nfg([filepath_or_buffer])

Save the game to a .nfg file or return its serialized representation

Attributes

contingencies

An iterator over the contingencies in the game.

description

Get or set the description of the game.

is_const_sum

Whether the game is constant sum.

is_perfect_recall

Whether the game is perfect recall.

max_payoff

The maximum payoff to any player in any play of the game.

min_payoff

The minimum payoff to any player in any play of the game.

players

The set of players in the game.

title

Get or set the title of the game.