The most visible component of Gambit, especially for the new user, is the graphical user interface. This program is an”integrated development environment” to help visually construct games and to investigate their strategic features.
The graphical interface is largely intended for the interactive construction and analysis of small to medium games. Repeating the caution from the introduction of this manual, the computation time required for the equilibrium analysis of games increases rapidly in the size of the game. The graphical interface is ideal for students learning about the fundamentals of game theory, or for practitioners prototyping games of interest. In graduating to larger applications, users are encouraged to make use of the underlying Gambit libraries and programs directly. See the chapter on command-line tools for detailed documentation on these programs.
The documentation of the graphical interface focuses on detailing the concepts and features of the program. To get started using the program, a few tutorials are available:
These tutorials illustrate the use of the graphical interface in analyzing some common types of games, and are suitable for users with any level of experience with game theory. Students, in particular, may find some of the examples helpful with coursework.
Once you’re comfortable with some of the tutorials, this manual ought to be helpful in filling in some of the gaps, and listing more completely the features of the graphical interface.
This section gives an overview of the graphical interface.
The frame presenting a game consists of two principal panels. The main panel, to the right, displays the game graphically; in this case, showing the game tree of a simple one-card poker game. To the left is the player panel, which lists the players in the game; here, Fred and Alice are the players. Note that where applicable, information is color-coded to match the colors assigned to the players: Fred’s moves and payoffs are all presented in red, and Alice’s in blue. The color assigned to a player can be changed by clicking on the color icon located to the left of the player’s name on the player panel. Player names are edited by clicking on the player’s name, and editing the name in the text control that appears.
Two additional panels are available. Selecting Tools ‣ Dominance toggles the display of an additional toolbar across the top of the window. This toolbar controls the indication and elimination of actions or strategies that are dominated. The use of this toolbar is discussed in Investigating dominated strategies and actions.
Selecting View ‣ Profiles, or clicking the show profiles icon on the toolbar, toggles the display of the list of computed strategy profiles on the game. More on the way the interface handles the computation of Nash equilibria and other kinds of strategy profiles is presented in Computing Nash equilibria.
Gambit stores all payoffs in games in an arbitrary-precision format. Payoffs may be entered as decimal numbers with arbitrarily many decimal places. In addition, Gambit supports representing payoffs using rational numbers. So, for example, in any place in which a payoff may appear, either an outcome of an extensive game or a payoff entry in a strategic game, the payoff one-tenth may be entered either as .1 or 1/10.
The advantage of this format is that, in certain circumstances, Gambit may be able to compute equilibria exactly. In addition, some methods for computing equilibria construct good numerical approximations to equilibrium points. For these methods, the computed equilibria are stored in floating-point format. To increase the number of decimal places shown for these profiles, click the increase decimals icon . To decrease the number of decimal places shown, click the decrease decimals icon .
Increasing or decreasing the number of decimals displayed in computed strategy profiles will not have any effect on the display of outcome payoffs in the game itself, since those are stored in arbitrary precision.
The graphical interface manipulates several different file formats for representing games. This section gives a quick overview of those formats.
Gambit has for many years supported two file formats for representing games, one for extensive games (typically using the filename extension .efg) and one for strategic games (typically using the filename extension .nfg). These file formats are recognized by all Gambit versions dating back to release 0.94 in 1995. (Users interested in the details of these file formats can consult Game representation formats for more information.)
Beginning with release 2005.12.xx, the graphical interface now reads and writes a new file format, which is referred to as a”Gambit workbook.” This extended file format stores not only the representation of the game, but also additional information, including parameters for laying out the game tree, the colors assigned to players, any equilibria or other analysis done on the game, and so forth. So, for example, the workbook file can be used to store the analysis of a game and then return to it. These files by convention end in the extension .gbt.
The graphical interface will read files in all three formats: .gbt, .efg, and .nfg. The “Save” and “Save as” commands, however, always save in the Gambit workbook (.gbt) format. To save the game itself as an extensive (.efg) or strategic (.nfg) game, use the items on the “Export” submenu of the “File” menu. This is useful in interfacing with older versions of Gambit, with other tools which read and write those formats, and in using the underlying Gambit analysis command- line tools directly, as those programs accept .efg or .nfg game files. Users primarily interested in using Gambit solely via the graphical interface are encouraged to use the workbook (.gbt) format.
As it is a new format, the Gambit workbook format is still under development and may change in details. It is intended that newer versions of the graphical interface will still be able to read workbook files written in older formats.
The graphical interface provides a flexible set of operations for constructing and editing general extensive games. These are outlined below.
To create a new extensive game, select File ‣ New ‣ Extensive game, or click on the new extensive game icon . The extensive game created is a trivial game with two players, named by default Player 1 and Player 2, with one node, which is both the root and terminal node of the game. In addition, extensive games have a special player labeled Chance, which is used to represent random events not controlled by any of the strategic players in the game.
There are two options for adding moves to a tree: drag-and-drop and the Insert move dialog.
The two methods can be useful in different contexts. The drag-and-drop approach is a bit quicker to use, especially when creating trees that have few actions at each move. The dialog approach is a bit more flexible, in that a move can be added for a new, as-yet-undefined player, a move can be added directly into an existing information set, and a move can be immediately given more than two actions.
Many extensive games have structures that appear in multiple parts of the tree. It is often efficient to create the structure once, and then copy it as needed elsewhere.
Gambit provides a convenient idiom for this. Clicking on any nonterminal node and dragging to any terminal node implements a move operation, which moves the entire subtree rooted at the original, nonterminal node to the terminal node.
When this same operation is done while holding down the Control (Ctrl) key on the keyboard, the operation is turned into a copy operation. The entire subtree rooted at the original node is copied, starting at the terminal node. In this copy operation, each node in the copied image is placed in the same information set as the corresponding node in the original subtree.
Copying a subtree to a terminal node in that subtree is also supported. In this case, the copying operation is halted when reaching the terminal node, to avoid an infinite loop. Thus, this feature can also be helpful in constructing multiple-stage games.
Two deletion operations are supported on extensive games. To delete the entire subtree rooted at a node, click on that node and select Edit ‣ Delete subtree.
To delete an individual move from the game, click on one of the direct children of that node, and select Edit ‣ Delete parent. This operation deletes the parent node, as well as all the children of the parent other than the selected node. The selected child node now takes the place of the parent node in the tree.
Gambit provides several methods to help manage the information structure in an extensive game.
When building a tree, new moves can be placed in a given information set using the Insert move dialog. Additionally, new moves can be created using the drag-and-drop idiom by holding down the Shift key and dragging a node in the tree. During the drag operation, the cursor changes to the move icon . Dropping the move icon on another node places the target node in the same information set as the node where the drag operation began.
The information set to which a node belongs can also be set by selecting Edit ‣ Node. This displays the node properties dialog. The Information set dropdown defaults to the current information set to which the node belongs, and contains a list of all other information sets in the game which are compatible with the node, that is, which have the same number of actions. Additionally, the node can be moved to a new, singleton information set by setting this dropdown to the New information set entry.
When building out a game tree using the drag-and-drop approach to copying portions of the tree, the nodes created in the copy of the subtree remain in the same information set as the corresponding nodes in the original subtree. In many cases, though, these trees differ in the information available to some or all of the players. To help speed the process of adjusting information sets in bulk, Gambit offers a “reveal” operation, which breaks information sets based on the action taken at a particular node. Click on a node at which the action taken is to be made known subsequently to other players, and select Edit ‣ Reveal. This displays a dialog listing the players in the game. Check the boxes next to the players who observe the outcome of the move at the node, and click OK. The information sets at nodes below the selected one are adjusted based on the action selected at this node.
This is an operation that is easier to see than the explain. See the poker tutorial (flash version; PDF version) for an application of the revelation operation in conjunction with the tree-copy operation.
The reveal operation only has an effect at the time it is done. In particular, it does not enforce the separation of information sets based on this information during subsequent editing of the game.
Gambit supports the specification of payoffs at any node in a game tree, whether terminal or not. Each node is created with no outcome attached; in this case, the payoff at each node is zero to all players. These are indicated in the game tree by the presence of a (u) in light grey to the right of a node.
To set the payoffs at a node, double-click on the (u) to the right of the node. This creates a new outcome at the node, with payoffs of zero for all players, and displays an editor to set the payoff of the first player.
The payoff to a player for an outcome can be edited by double-clicking on the payoff entry. This action creates a text edit control in which the payoff to that player can be modified. Edits to the payoff can be accepted by pressing the Enter key. In addition, accepting the payoff by pressing the Tab key both stores the changes to the player’s payoff, and advances the editor to the payoff for the next player at that outcome.
Outcomes may also be moved or copied using a drag-and-drop idiom. Left-clicking and dragging an outcome to another node moves the outcome from the original node to the target node. Copying an outcome may be accomplished by doing this same action while holding down the Control (Ctrl) key on the keyboard.
When using the copy idiom described above, the action assigns the same outcome to both the involved nodes. Therefore, if subsequently the payoffs of the outcome are edited, the payoffs at both nodes will be modified. To copy the outcome in such a way that the outcome at the target node is a different outcome from the one at the source, but with the same payoffs, hold down the Shift key instead of the Control key while dragging.
To remove an outcome from a node, click on the node, and select Edit ‣ Remove outcome.
Gambit offers some options for customizing the display of game trees.
Beginning in version 0.2005.12.12, all formatting information, including colors, fonts, layout, labeling, and so forth, are stored with the game in the Gambit workbook ( .gbt ) file format. This contrasts with previous behavior of the graphical interface, in which the settings were stored on a per-user basis, and games were displayed with the current settings only.
The information displayed at the nodes and on the branches of the tree can be configured by selecting Format ‣ Labels, which displays the tree labels dialog.
Above and below each node, the following information can be displayed:
Above and below each branch, the following information can be displayed:
Gambit implements an automatic system for layout out game trees, which provides generally good results for most games. These can be adjusted by selecting Format ‣ Layout. The layout parameters are organized on three tabs.
The first tab, labeled Nodes, controls the size, location, and rendering of nodes in the tree. Nodes can be indicated using one of five tokens: a horizontal line (the “traditional” Gambit style from previous versions), a box, a diamond, an unfilled circle, and a filled circle). These can be set independently to distinguish chance and terminal nodes from player nodes.
The sizing of nodes can be configured for best results. Gambit styling from previous versions used the horizontal line tokens with relatively long lines; when using the other tokens, smaller node sizes often look better.
The layout algorithm is based upon identifying the location of terminal nodes. The vertical spacing between these nodes can be set; making this value larger will tend to give the tree a larger vertical extent.
The second tab, labeled Branches, controls the display of the branches of the tree. The traditional Gambit way of drawing branches is a “fork-tine” approach, in which there is a flat part at the end of each branch at which labels are displayed. Alternatively, branches can be drawn directly between nodes by setting Draw branches to using straight lines between nodes. With this setting, labels are now displayed at points along the (usually) diagonal branches. Labels are usually shown horizontally; however, they can be drawn rotated parallel to the branches by setting Draw labels to rotated.
The rotated label drawing is experimental, and does not always look good on screen.
The length used for branches and their tines, if drawn, can be configured. Longer branch and tine lengths give more space for longer labels to be drawn, at the cost of giving the tree a larger horizontal extent.
Finally, display of the information sets in the game is configured under the tab labeled Information sets. Members of information sets are by default connected using a “bubble” similar to that drawn in textbook diagrams of games. The can be modified to use a single line to connect nodes in the same information set. In conjunction with using lines for nodes, this can sometimes lead to a more compact representation of a tree where there are many information sets at the same horizontal location.
The layout of the tree may be such that members of the same information set appear at different horizontal locations in the tree. In such a case, by default, Gambit draws a horizontal arrow pointing rightward or leftward to indicate the continuation of the information set, as illustrated in the diagram nearby.
These connections can be disabled by setting Connect members of information sets to only when on the same level. In addition, drawing information set indicators can be disabled entirely by setting this to invisibly (don’t draw indicators).
To select the font used to draw the labels in the tree, select Format ‣ Font. The standard font selection dialog for the operating system is displayed, showing the fonts available on the system. Since available fonts vary across systems, when opening a workbook on a system different from the system on which it was saved, Gambit tries to match the font style as closely as possible when the original font is not available.
The color-coding for each player can be changed by clicking on the color icon to the left of the corresponding player.
Gambit has full support for constructing and manipulating arbitrary N-player strategic (also known as normal form) games.
For extensive games, Gambit automatically computes the corresponding reduced strategic game. To view the reduced strategic game corresponding to an extensive game, select View ‣ Strategic game or click the strategic game table icon on the toolbar.
The strategic games computed by Gambit as the reduced strategic game of an extensive game cannot be modified directly. Instead, edit the original extensive game; Gambit automatically recomputes the strategic game after any changes to the extensive game.
Strategic games may also be input directly. To create a new strategic game, select File ‣ New ‣ Strategic game, or click the new strategic game icon on the toolbar.
To add an additional player to the game, use the menu item Edit ‣ Add player, or the corresponding toolbar icon . The newly created player has one strategy, by default labeled with the number 1.
Gambit supports arbitrary numbers of strategies for each player. To add a new strategy for a player, click the new strategy icon located to the left of that player’s name.
To edit the names of strategies, click on any cell in the strategic game table where the strategy label appears, and edit the label using the edit control.
Payoffs for each player are specified individually for each contingency, or collection of strategies, in the game. To edit any payoff in the table, click that cell in the table and edit the payoff. Pressing the Escape key (Esc) cancels any editing of the payoff and restores the previous value.
To speed entry of many payoffs, as is typical when creating a new game, accepting a payoff entry via the Tab key automatically moves the edit control to the next cell to the right. If the payoff is the last payoff listed in a row of the table, the edit control wraps around to the first payoff in the next row; if the payoff is in the last row, the edit control wraps around to the first payoff in the first row. So a strategic game payoff table can be quickly entered by clicking on the first payoff in the upper-left cell of the table, inputting the payoff for the first (row) player, pressing the Tab key, inputting the payoff for the second (column) player, pressing the Tab key, and so forth, until all the payoff entries in the table have been filled.
Selecting Tools ‣ Dominance toggles the appearance of a toolbar which can be used to investigate the structure of dominated strategies and actions.
In extensive games, the dominance toolbar controls the elimination of actions which are conditionally dominated.
Actions may be eliminated based on two criteria:
For example, in the poker game, it is strictly dominated for Fred to choose Fold after Red. Clicking the next level icon removes the dominated action from the game display.
The tree layout remains unchanged, including nodes which can only be reached using actions which have been eliminated. To compress the tree to remove the unreachable nodes, check the box labeled Show only reachable nodes.
For this game, no further actions can be eliminated. In general, further steps of elimination can be done by again clicking the next level icon. The toolbar keeps track of the number of levels of elimination currently shown; the previous level icon moves up one level of elimination.
The elimination of multiple levels can be automated using the fast forward icon , which iteratively eliminates dominated actions until no further actions can be eliminated. The rewind icon restores the display to the full game.
The dominance toolbar operates in strategic games in the same way as the in the extensive game. Strategies can be eliminated iteratively based on whether they are strictly or weakly dominated.
When the dominance toolbar is shown, the strategic game table contains indicators of strategies that are dominated. In the prisoner’s dilemma, the Cooperate strategy is strictly dominated for both players. This strict dominance is indicated by the solid “X” drawn across the corresponding strategy labels for both players. In addition, the payoffs corresponding to the dominated strategies are also drawn with a solid “X” across them. Thus, any contingency in the table containing at least one “X” is a contingency that can only be reached by at least one player playing a strategy that is dominated.
Strategies that are weakly dominated are similarly indicated, except the “X” shape is drawn using a thinner, dashed line instead of the thick, solid line.
Clicking the next level icon removes the strictly dominated strategies from the display.
Gambit offers broad support for computing Nash equilibria in both extensive and strategic games. To access the provided algorithms for computing equilibria, select Tools ‣ Equilibrium, or click on the calculate icon on the toolbar.
The process of computing Nash equilibria in extensive and strategic games is similar. This section focuses on the case of extensive games; the process for strategic games is analogous, except the extensive game-specific features, such as displaying the profiles on the game tree, are not applicable.
Gambit provides guidance on the options for computing Nash equilibria in a dialog. The methods applicable to a particular game depend on three criteria: the number of equilibria to compute, whether the computation is to be done on the extensive or strategic games, and on details of the game, such as whether the game has two players or more, and whether the game is constant-sum.
The first step in finding equilibria is to specify how many equilibria are to be found. Some algorithms for computing equilibria are adapted to finding a single equilibrium, while others attempt to compute the whole equilibrium set. The first drop-down in the dialog specifies how many equilibria to compute. In this drop-down there are options for as many equilibria as possible and all equilibria. For some games, there exist algorithms which will compute many equilibria (relatively) efficiently, but are not guaranteed to find all equilibria.
To simplify this process of choosing the method to compute equilibria in the second drop-down, Gambit provides for any game “recommended” methods for computing one, some, and all Nash equilibria, respectively. These methods are selected based on experience as to the efficiency and reliability of the methods, and should generally work well on most games. For more control over the process, the user can select from the second drop-down in the dialog one of the appropriate methods for computing equilibria. This list only shows the methods which are appropriate for the game, given the selection of how many equilibria to compute. More details on these methods are contained in Command-line tools.
Finally, for extensive games, there is an option of whether to use the extensive or strategic game for computation. In general, computation using the extensive game is preferred, since it is often a significantly more compact representation of the strategic characeteristics of the game than the reduced strategic game is.
For even moderate sized games, computation of equilibrium can be a time-intensive process. Gambit runs all computations in the background, and displays a dialog showing all equilibria computed so far. The computation can be cancelled at any time by clicking on the cancel icon , which terminates the computation but keeps any equilibria computed.
After computing equilibria, a panel showing the list of equilibria computed is displayed automatically. The display of this panel can be toggled by selecting View ‣ Profiles, or clicking on the playing card icon on the toolbar.
This game has a unique equilibrium in which Fred raises after Red with probability one, and raises with probability one-third after Black. Alice, at her only information set, plays meet with probability two- thirds and raise with probability one-third.
This equilibrium is displayed in a table in the profiles panel. If more than one equilibrium is found, this panel lists all equilibria found. Equilibria computed are grouped by separate computational runs; computing equilibria using a different method (or different settings) will add a second list of profiles. The list of profiles displayed is selected using the drop-down at the top left of the profiles panel; in the screenshot, it is set to Profiles 1. A brief description of the method used to compute the equilibria is listed across the top of the profiles panel.
The currently selected equilibrium is shown in bold in the profiles listing, and information about this equilibrium is displayed in the extensive game. In the figure, the probabilities of selecting each action are displayed below each branch of the tree. (This is the default Gambit setting; see Controlling the layout of the tree for configuring the labeling of trees.) Each branch of the tree also shows a black line, the length of which is proportional to the probability with which the action is played.
Clicking on any node in the tree displays additional information about the profile at that node. The player panel displays information relevant to the selected node, including the payoff to all players conditional on reaching the node, as well as information about Alice’s beliefs at the node.
The computed profiles can also be viewed in the reduced strategic game. Clicking on the strategic game icon changes the view to the reduced strategic form of the game, and shows the equilibrium profiles converted to mixed strategies in the strategic game.
To compute the correspondence, select Tools ‣ Qre. If viewing an extensive game, the agent quantal response equilibrium correspondence is computed; if viewing a strategic game (including the reduced strategic game derived from an extensive game), the correspondence is computed in mixed strategies.
The computed correspondence values can be saved to a CSV (comma- separated values) file by clicking the button labeled Save correspondence to .csv file. This format is suitable for reading by a spreadsheet or graphing application.
There is an experimental graphing interface for quantal response equilibria in strategic games. The graph by default plots the probabilities of all strategies, color- coded by player, as a function of the lambda parameter. The lambda values on the horizontal axis are plotted using a sigmoid transformation; the Graph scaling value controls the shape of this transformation. Lower values of the scaling give more graph space to lower values of lambda; higher values of the scaling give more space to higher values of lambda.
The strategies graphed are indicated in the panel at the left of the window. Clicking on the checkbox next to a strategy toggles whether it is displayed in the graph.
The data points computed in the correspondence can be viewed (as in the extensive game example above) by clicking on the show data icon on the toolbar. The data points can be saved to a CSV file by clicking on the .
To zoom in on a portion of the graph of interest, hold down the left mouse button and drag a rectangle on the graph. The plot window zooms in on the portion of the graph selected by that rectangle. To restore the graph view to the full graph, click on the zoom to fit icon .
To print the graph as shown, click on the print icon . Note that this is very experimental, and the output may not be very satisfactory yet.
Gambit supports (almost) WYSIWYG (what you see is what you get) output of both extensive and strategic games, both to a printer and to several graphical formats. For all of these operations, the game is drawn exactly as currently displayed on the screen, including whether the extensive or strategic representation is used, the layout, colors for players, dominance and probability indicators, and so forth.
To print the game, press Ctrl-P, select File ‣ Print, or click the printer icon on the toolbar. The game is scaled so that the printout fits on one page, while maintaining the same ratio of horizontal to vertical size; that is, the scaling factor is the same in both horizontal and vertical dimensions.
Note that especially for extensive games, one dimension of the tree is much larger than the other. Typically, the extent of the tree vertically is much greater than its horizontal extent. Because the printout is scaled to fit on one page, printing such a tree will generally result in what appears to be a thin line running vertically down the center of the page. This is in fact the tree, shrunk so the large vertical dimension fits on the page, meaning that the horizontal dimension, scaled at the same ratio, becomes very tiny.
Gambit supports export to five graphical file formats:
To export a game to one of these formats, select File ‣ Export, and select the corresponding menu entry.
The Windows bitmap and PNG formats are generally recommended for export, as they both are lossless formats, which will reproduce the game image exactly as in Gambit. PNG files use a lossless compression algorithm, so they are typically much smaller than the Windows bitmap for the same game. Not all image viewing and manipulation tools handle PNG files; in those cases, use the Windows bitmap output instead. JPEG files use a compression algorithm that only approximates the original version, which often makes it ill-suited for use in saving game images, since it often leads to “blocking” in the image file.
For all three of these formats, the dimensions of the exported graphic are determined by the dimensions of the game as drawn on screen. Image export is only supported for games which are less than about 65000 pixels in either the horizontal or vertical dimensions. This is unlikely to be a practical problem, since such games are so large they usually cannot be drawn in such a way that a human can make sense of them.
Encapsulated PostScript output is generally useful for inclusion in LaTeX and other scientific document preparation systems. This is a vector-based output, and thus can be rescaled much more effectively than the other output formats.