Gambit is written in C++. This chapter gives an overview of the underlying library of classes which represent and manipulate games.
This chapter does not go into exhaustive detail about all functions and classes implemented in libgambit. Programmers interested in using the library in their own applications should consult the Doxygen-generated source documentation available from the Documentation page of the Gambit website, as well as the sample programs.
Gambit also provides an interface to the library for scripting languages by the use of SWIG (http://www.swig.org). Currently, only an interface for Python (http://www.python.org) is available. The SWIG wrapper should be easily modifiable to create interfaces for the other languages SWIG supports.
The file libgambit/libgambit.h includes all the header files for all classes and functions. To help play nice with other libraries, all classes and functions in libgambit are contained in the namespace Gambit.
The development of much of Gambit occurred during 1994 and 1995. As this predates the formal standardization of the Standard Template Library (and, in fact, C++ itself), as well as other standard libraries for reusable container and similar classes, Gambit has its own implementation of some of these classes. This section outlines those facilities. In the longer term, the goal is to evolve these classes to be more compatible with STL and/or with another standard library, and to possibly migrate fully to such a library. Table 4-1 lists the generic container classes provided by the library.
Table 4-1. Container classes in libgambit
| Class | Description |
|---|---|
| Array | A basic bounds-checked array |
| List | A doubly-linked list |
| Map | A sorted associative container |
| Vector | A mathematical vector |
| PVector | A singly-partitioned vector |
| DVector | A doubly-partitioned vector |
| RectArray | A basic bounds-checked rectangular array |
| Matrix | A mathematical matrix |
| SquareMatrix | A mathematical square matrix |
The Array and List classes
are the basic generic one-dimensional containers; they have identical
interfaces, and as such may be used interchangeably. Thus,
List is similar to the STL's list.
Array is parallel to STL's
vector; note that Gambit reserves
Vector to represent mathematical objects of
that name (i.e., they are Arrays which have
the standard mathematical operations defined on them). The third
generic container is Map, which is similar to
STL's map, which associates a key to a value.
![]() | For historical reasons, and in contrast to STL and indexing conventions
in C, C++, Python, and most languages, the |