Skip to main content

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

Release files for gamescape 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for gamescape 0.1.0
File Size Uploaded
gamescape-0.1.0.tar.gz 11.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for gamescape 0.1.0
File Interpreter ABI Platform
gamescape-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 21.1 kB

Release files / gamescape-0.1.0.tar.gz

Download URL gamescape-0.1.0.tar.gz
Size 11.3 kB
Tags Source
SHA-256 checksum
How to use checksums
6bcf71130c07760dd1cf3bc7bf30f3dec75069d5513a1dff2598464e4f530f6d
BLAKE2b-256 checksum
How to use checksums
eca6fdc50e186e462e7f5ecc61abdd9b58f7aacb336a169896442aca9c922d4c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.5

Release files / gamescape-0.1.0-py3-none-any.whl

Download URL gamescape-0.1.0-py3-none-any.whl
Size 9.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
476a61d7a88ba15fa3e6cc611d1da42653c12f7e6132ced294d9d089fd4c058f
BLAKE2b-256 checksum
How to use checksums
5b10e93844560c35ce193f05e8f71cd01e4e01da7dc3a88ffbd8c3d3ae2a1863
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.5

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page