gamescape
Visualize evolutionary game theory dynamics in your terminal. Computes replicator equations, finds fixed points, classifies games, and renders ASCII phase portraits.
Install
pip install -e .
Usage
# Analyze a classic game
gamescape prisoners-dilemma
gamescape stag-hunt
gamescape hawk-dove
gamescape coordination
gamescape harmony
# Custom payoff matrix (CC, CD, DC, DD)
gamescape --matrix 3,0,5,1
# List available games
gamescape --list
# Disable colors
gamescape hawk-dove --no-color
What it shows
- Payoff matrix — the 2x2 symmetric game
- Classification — dominant-cooperate, dominant-defect, coordination, coexistence, bistable
- Fixed points — boundary and interior equilibria with stability (
@= stable,o= unstable) - Phase flow — 1D flow line showing direction of replicator dynamics
- Trajectories — x(t) plot from 5 initial conditions converging to attractors
Example output
Classification: coexistence
Fixed Points:
o x=0.0000 (all-D, unstable)
@ x=0.2857 (interior, stable)
o x=1.0000 (all-C, unstable)
Phase Flow:
all-D |o>>>>>>>>>>>>>>>>@<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<o| all-C
As a library
from gamescape.dynamics import PayoffMatrix, find_fixed_points, classify_game, trajectory
game = PayoffMatrix(a=3, b=0, c=5, d=1) # Prisoner's Dilemma
print(classify_game(game)) # "dominant-defect"
for fp in find_fixed_points(game):
print(f"x={fp.x:.2f} stable={fp.stable} ({fp.label})")
traj = trajectory(game, x0=0.5) # simulate from x=0.5
Tests
pip install -e ".[dev]"
pytest tests/ -v
License
MIT
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
gamescape-0.1.0.tar.gz
(11.3 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file gamescape-0.1.0.tar.gz.
File metadata
- Download URL: gamescape-0.1.0.tar.gz
- Upload date:
- Size: 11.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6bcf71130c07760dd1cf3bc7bf30f3dec75069d5513a1dff2598464e4f530f6d
|
|
| MD5 |
b8cf5dbbdc262697525020a9bfe2fd4a
|
|
| BLAKE2b-256 |
eca6fdc50e186e462e7f5ecc61abdd9b58f7aacb336a169896442aca9c922d4c
|
File details
Details for the file gamescape-0.1.0-py3-none-any.whl.
File metadata
- Download URL: gamescape-0.1.0-py3-none-any.whl
- Upload date:
- Size: 9.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
476a61d7a88ba15fa3e6cc611d1da42653c12f7e6132ced294d9d089fd4c058f
|
|
| MD5 |
4563f08b4cbd96f0a530542957208bd3
|
|
| BLAKE2b-256 |
5b10e93844560c35ce193f05e8f71cd01e4e01da7dc3a88ffbd8c3d3ae2a1863
|