Gambit

Software Tools for Game Theory

Richard McKelvey

California Institute of Technology

Andrew McLennan

University of Minnesota

Theodore Turocy

Texas A&M University

Table of Contents
Introduction
History and acknowledgements
Gambit versions and version numbers
Gambit release history
Getting and installing Gambit
Contacting or contributing to the Gambit Project
About this manual
Getting Started with the Graphical Interface
A simple game of poker
Finding Nash equilibria using the extensive form
Finding Nash equilibria using the normal form
Graphical Interface Reference
Conventions used in the graphical interface
Structure of game windows
Working with strategy profiles
Working with supports
Working with outcomes
Standard Nash equilibrium algorithms
Extensive form games
Extensive form games: Conventions and preliminaries
Creating a new extensive form game
Reading an extensive form game from disk
Adding or inserting a move into the tree
Navigating extensive form game trees
Viewing and changing extensive form game properties
Changing how the tree is displayed
Normal form games
The normal form table
Standard Nash equilibrium algorithms
The Gambit Command Language
Introduction to the command language
Command line editing
Meaning of the prompt
Basic concepts
Data types
Boolean
Numeric data types
Text
Input and output
Normal form data types
Extensive form data types
Lists
Conglomerate data types
Expressions
Functions
Constants
Variables
Built-in functions
User-defined functions
Aliases for function calls
Getting and suppressing console output
Lists
Building and modifying lists
Listability of functions
Online documentation
Advanced topics
Including files
Flow control structures
Input and output
Null values
System information
Variables pointing to deleted objects
Errors
Constructing and manipulating games
Normal form games
Extensive forms
Solving games
Supports and dominance elimination
Subgames
Mixed and behavior strategy profiles
Command Language Function Reference
Built-in functions
Accuracy — Returns the accuracy used by the algorithm which computed a profile
ActionNumber — Returns the index of an action in a support or basis
ActionProb — Returns the probability an action is chosen in a behavior profile
Actions — Returns the list of actions in a support at an information set
ActionValue — Returns the expected payoff to playing an action, given a profile
AddAction — Adds an action to a support or basis
AddMove — Adds a move to a game at a terminal node
AddNode — Adds a node to a basis
AddStrategy — Adds a strategy to a support
AgentForm — Creates the agent normal form for an extensive form game
And — Returns the logical conjunction of two boolean values
ArgMax — Returns the index of a maximal element of a list
Assign — Sets the value of a variable
Basis — Creates a basis for an extensive form game
Behav — Converts a mixed profile into the equivalent behavior profile
Behav — Creates a behavior profile on a support
Belief — Returns the probability of being at a node, given the information set
Chance — Returns the chance player for an extensive form
ChanceProb — Returns the probability an action is chosen by nature
Children — Returns the list of children of a node
Clear — Unassigns all variables in the current scope
Comment — Returns the comment associated with a game
CompressEfg — Creates an extensive form containing only the actions in a support
CompressNfg — Creates a normal form containing only the actions in a support
Concat — Concatenates two lists
Contains — Tests for the presence of an element in a list
CopyTree — Copies a subtree to a terminal node
Creator — Returns the algorithm that created a profile
Date — Returns the current date and time
DeleteAction — Removes an action from all nodes in its information set
DeleteEmptyInfoset — Removes an information set from a game
DeleteMove — Removes a move from an extensive form game
DeleteOutcome — Removes an outcome from a game
DeleteTree — Removes a subtree from an extensive form game
Divide — Returns the quotient of two numbers
Dot — Returns the dot product of two vectors
ElapsedTime — Returns the time on the stopwatch
EnumMixedSolve — Computes Nash equilibria via mixed strategy enumeration
EnumPureSolve — Computes Nash equilibria via pure strategy enumeration
Equal — Determines if two values are equal
ExePath — Returns the path of the GCL executable
Exp — Evaluates the exponential function
Filter — Filters a list based on a criterion
Flatten — Removes nesting from a list
Float — Converts a number to floating-point precision
For — Iterates over a block of functions
Format — Sets various formatting options
Game — Returns the game to which an object belongs
GetEnv — Returns the value of an environment variable
GetFormat — Returns information on output formatting
GetListFormat — Returns information on list output formatting
GetPath — Returns the path of the currently-read input file
Greater — Determines whether a value is greater than another
GreaterEqual — Determines whether a value is greater than or equal to another
Help — Returns help on defined functions
HelpVars — Returns help on defined variables
If — Evaluates expressions conditionally
Include — Reads GCL expressions from a file
Index — Returns the indices at which a value appears in a list
Infoset — Returns the information set to which an action or node belongs
InfosetProb — Returns the probability of reaching an information set
Infosets — Returns the information sets for a player
InfosetValue — Returns the value of reaching an information set
Input — Opens an input stream for reading
InsertAction — Inserts an action at an information set
InsertMove — Inserts a node in an extensive form
Integer — Converts a number to an integer value
IntegerDivide — Returns the quotient of two integers
Inverse — Computes the inverse of a square matrix
IsConsistent — Checks whether a basis is consistent
IsConstSum — Determines whether a game is constant sum
IsDefined — Returns whether a variable has been defined
IsDominated — Returns whether a strategy or action is dominated
IsEof — Returns whether the end of a file has been reached
IsList — Determines whether a value is a list
IsNash — Returns whether a profile is a Nash equilibrium
IsNull — Returns whether a variable is null
IsPerfect — Returns whether a profile is a perfect equilibrium
IsPerfectRecall — Returns whether an extensive form has perfect recall
IsPredecessor — Computes whether one node precedes another in a tree
IsSequential — Returns whether a profile is a sequential equilibrium
IsSubgamePerfect — Returns whether a profile is a subgame perfect equilibrium
IsSuccessor — Returns whether one node succeeds another in a tree
IsWatchRunning — Returns whether the stopwatch is running
LcpSolve — Computes Nash equilibria via linear complementarity program
Length — Returns the number of elements in a list
Less — Determines whether a value is less than another
LessEqual — Determines whether a value is less than or equal to another
LiapSolve — Computes Nash equilibria via function minimization
LiapValue — Computes the Lyapunov function for a profile
List — Creates a list or sequence
ListFormat — Sets the formatting style for output of lists
LoadEfg — Loads an extensive form game from file
LoadNfg — Loads a normal form game from file
Log — Returns the natural logarithm of a number
LpSolve — Computes Nash equilibria using linear programming
Manual — Prints the manual entry for a function
MarkSubgame — Marks a subgame root
MarkedSubgame — Returns whether a subgame root is marked
Members — Returns the node which belong to an information set
MergeInfosets — Combines two information sets
Minus — Returns the difference of two numbers or profiles
Mixed — Creates a mixed strategy profile on a support
Modulus — Computes the remainder from integer division
MoveToInfoset — Places a node in an information set
MoveTree — Moves an entire subtree in an extensive form game
Name — Returns the text label of an object
Negate — Returns the negation of a number
NewEfg — Creates a new extensive form game
NewFunction — Creates a user-defined function
NewInfoset — Creates a new information set in an extensive form game
NewNfg — Creates a normal form game
NewOutcome — Creates a new outcome in a game
NewPlayer — Creates a new player in an extensive form game
NextSibling — Returns the next sibling of a node
Nfg — Creates the reduced normal form corresponding to an extensive form
NodeNumber — Returns the number of a node in a basis
NodeValue — Returns the expected payoff to a player of being at a node
Nodes — Returns the nodes in a game or basis
Not — Returns the logical negation of a value
NotEqual — Determines if two values are not equal
NthChar — Extracts a character from a string
NthChild — Returns a child of a node, by index
NthElement — Returns an element of a list, by index
Null — Returns a null object of a specified type
NumChars — Returns the length of a text string
NumElements — Returns the number of elements in a list
Or — Returns the logical disjunction of two values
Outcome — Returns the outcome of a node or contingency
Outcomes — Returns the outcomes defined on a game
Output — Opens a file for output
Parent — Returns the parent of a node
Parentheses — Returns its parameter
Payoff — Returns the payoff associated with an object
Platform — Returns a string identifying the system
Player — Returns the player corresponding to an object
Players — Returns the list of players in a game
Plus — Returns the sum of two numbers or profiles, or the concatenation of two strings
PolEnumSolve — Computes Nash equilibria by enumerating solutions to polynomial equations
PossibleNashSupports — Returns the list of supports that could be supports of Nash equilibria
Power — Raises a number to a power
Precision — Returns the precision of a number
Print — Prints a value to the console
PriorAction — Returns the action immediately before a node
PriorSibling — Returns the previous sibling of a node
QreGridSolve — Computes quantal response equilibria via a grid search
QreLambda — Returns the value of lambda for which a profile is a QRE
QreSolve — Computes quantal response equilibria via homotopy path following
Quit — Exits the command language
Randomize — Returns a random number
Rational — Converts a number to rational precision
Read — Reads a value from an input stream
ReadText — Reads data from an input stream as text
RealizProb — Returns the probability a node is reached
Regret — Returns the gain from deviating to an action or strategy
Regrets — Returns the gain from deviating to an action or strategy
Remove — Removes an element from a list
RemoveAction — Removes an action from a support
RemoveNode — Removes a node from a basis
RemoveStrategy — Removes a strategy from a support
Reveal — Reveals the actions at an information set to specified players
RootNode — Returns the root node of an extensive form
SaveEfg — Writes an extensive form game to a file
SaveNfg — Writes a normal form game to a file
SequenceForm — Returns the sequence form of an extensive form game
SequenceFormConstraints — Returns the strategy constraints for a player in a sequence form
SequenceFormStrats — Returns the sequence form strategies of a player
SetActionProb — Sets the probability an action is played in a profile
SetActionProbs — Sets the probabilities actions are played at an information set
SetChanceProbs — Sets the probabilities chance actions are played at an information set
SetComment — Sets the comment associated with a game
SetEnv — Sets an environment variable
SetName — Sets the text label of an object
SetOutcome — Sets the outcome at a node or contingency
SetPayoff — Sets the payoff to a player of an outcome
SetStrategyProb — Sets the probability a strategy is played in a profile
SetStrategyProbs — Sets the probabilities for a player in a profile
Shell — Runs a child process
SimpDivSolve — Compute Nash equilibria via simplicial subdivision
Sort — Sorts a list
StartWatch — Starts the system stopwatch
StopWatch — Starts the system stopwatch
Strategies — Returns the list of strategies belonging to a player
StrategyNumber — Returns the index of a strategy in a support
StrategyProb — Returns the index of a strategy in a support
StrategyProbs — Returns the list of strategy probabilities for a profile
StrategyValue — Returns the payoff to playing a strategy against a profile
StrategyValues — Returns the payoff to playing a strategy against a profile
Subgames — Returns the list of subgame roots in an extensive form game
Support — Returns the support of a game or profile
Text — Converts a value to a text string
Times — Returns the product of two numbers, or a number and a profile
Transpose — Returns the transpose of a rectangular matrix
UnAssign — Undefines a variable
UnDominated — Computes the undominated actions or strategies in a support
UnMarkSubgame — Removes a subgame from the list used by Nash equilibrium algorithms
UnSetEnv — Unsets an environment variable
Version — Returns the version of Gambit
While — Iterates over expressions while a condition is true
Write — Writes an object to a text stream
WriteSequenceForm — Writes the sequence form for an extensive form game to a stream
Categorical listing of functions
General functionality
Basic data types
Input and output
Building games
Solving games
Reference: Algorithms to Compute Nash Equilibria
Tips on getting started
Common algorithm parameters
Pure strategy equilibria
Two Person Constant Sum Games
Two Person Games
Games With More Than Two Players
Sequential Equilibria
EnumMixedSolve
EnumPureSolve
QreSolve
QreGridSolve
LcpSolve
LiapSolve
LpSolve
PolEnumSolve
SimpDivSolve
Bibliography
Index