Chadwick Gambit: Software Tools for Game Theory

pygambit.gambit.Game#

class pygambit.gambit.Game#

A game, the fundamental unit of analysis in game theory.

Games may be represented in extensive or strategic form.

Methods

add_action(infoset[, before])

Add an action at the information set infoset.

add_outcome([payoffs, label])

Add a new outcome to the game.

add_player([label])

Add a new player to the game.

add_strategy(player[, label])

Add a new strategy to the set of strategies for player.

append_infoset(nodes, infoset)

Add a move in information set infoset at terminal nodes.

append_move(nodes, player, actions)

Add a move for player at terminal nodes.

copy_tree(src, dest)

Copy the subtree rooted at 'src' to 'dest'.

delete_action(action)

Deletes action from its information set.

delete_outcome(outcome)

Delete an outcome from the game.

delete_parent(node)

Delete the parent node of node.

delete_strategy(strategy)

Delete strategy from the game.

delete_tree(node)

Truncate the game tree at node, deleting the subtree beneath it.

from_arrays(*arrays[, title])

Create a new Game with a strategic representation.

from_dict(payoffs[, title])

Create a new Game with a strategic representation.

insert_infoset(node, infoset)

Insert a move in information set infoset prior to the node node.

insert_move(node, player, actions)

Insert a move for player prior to the node node, with actions actions.

leave_infoset(node)

Remove this node from its information set.

mixed_behavior_profile([data, rational])

Create a mixed behavior profile over the game.

mixed_strategy_profile([data, rational])

Create a mixed strategy profile over the game.

move_tree(src, dest)

Move the subtree rooted at 'src' to 'dest'.

new_table(dim[, title])

Create a new Game with a strategic representation.

new_tree([players, title])

Create a new Game consisting of a trivial game tree, with one node, which is both root and terminal.

nodes([subtree])

Return a list of nodes in the game tree.

parse_game(text)

Construct a game from its serialised representation in a string

random_behavior_profile([denom, gen])

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

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.

read_game(filepath)

Construct a game from its serialised representation in a file.

reveal(infoset, player)

Reveals the move made at infoset to player.

set_chance_probs(infoset, probs)

Set the action probabilities at chance information set infoset.

set_infoset(node, infoset)

Place node in the information set infoset.

set_outcome(node, outcome)

Set outcome to be the outcome at node.

set_player(infoset, player)

Set the player at an information set.

support_profile()

write([format])

Produce a serialization of the game.

Attributes

actions

The set of actions available in the game.

comment

Get or set the comment of the game.

contingencies

An iterator over the contingencies in the game.

infosets

The set of information sets in the game.

is_const_sum

Whether the game is constant sum.

is_perfect_recall

Whether the game is perfect recall.

is_tree

Return whether a game has a tree-based representation.

max_payoff

The maximum payoff in the game.

min_payoff

The minimum payoff in the game.

outcomes

The set of outcomes in the game.

players

The set of players in the game.

root

The root node of the game.

strategies

The set of strategies in the game.

title

Get or set the title of the game.