Games.jl
Games.jl is a Julia
package about algorithms and data structures for Game Theory.
Installation
Games.jl is an unregistered package that is currently under development.
To install the package, open a Julia
session and type
Pkg.clone("https://github.com/QuantEcon/Games.jl")
Usage
Once installed, the Games
package can be used by typing
using Games
The Base type Player
can be created by passing a payoff matrix.
player1 = Player([3 1; 0 2])
2×2 Player{2,Int64}:
3 1
0 2
A 2-player NormalFormGame
can be created either by passing Player
instances,
player2 = Player([2 0; 1 3])
g = NormalFormGame((player1, player2))
2×2 NormalFormGame{2,Int64}
or by passing a payoff matrix directly.
payoff_bimatrix = Array{Int}(undef, 2, 2, 2)
payoff_bimatrix[1, 1, :] = [3, 2]
payoff_bimatrix[1, 2, :] = [1, 1]
payoff_bimatrix[2, 1, :] = [0, 0]
payoff_bimatrix[2, 2, :] = [2, 3]
g = NormalFormGame(payoff_bimatrix)
2×2 NormalFormGame{2,Int64}
After constructing a NormalFormGame
, we can find its Nash Equilibria by using methods of Games
. For example, pure_nash
finds all pure action Nash Equilibria by enumeration.
pure_nash(g)
2-element Array{Tuple{Int64,Int64},1}:
(1, 1)
(2, 2)
Please see the notebooks on QuantEcon for more details.
Notebooks
Some notebooks for this package are available on QuantEcon. See: