|
| 1 | +# Axelrod Tournament |
| 2 | + |
| 3 | +**One model, many views** — an interactive exploration of Axelrod's iterated Prisoner's Dilemma tournament, built on the GDS ecosystem. |
| 4 | + |
| 5 | +[:octicons-link-external-16: Live Site](https://blockscience.github.io/gds-axelrod/) [:octicons-mark-github-16: Source](https://github.com/BlockScience/gds-axelrod) |
| 6 | + |
| 7 | +--- |
| 8 | + |
| 9 | +## Overview |
| 10 | + |
| 11 | +[gds-axelrod](https://github.com/BlockScience/gds-axelrod) demonstrates how a single OGS game specification can be projected through six distinct analytical lenses — from narrative storytelling to formal mathematical decomposition to interactive parameter exploration — without simplification or compromise. |
| 12 | + |
| 13 | +The project is a concrete realization of the **specification-as-interoperability-layer** pattern described in the [Interoperability Guide](../guides/interoperability.md): one compositional model serves as the single source of truth, and multiple independent tools consume it for different purposes. |
| 14 | + |
| 15 | +## Architecture |
| 16 | + |
| 17 | +The project splits into two tiers: |
| 18 | + |
| 19 | +``` |
| 20 | +Pipeline (Python) Site (Vite/JavaScript) |
| 21 | +┌──────────────────────┐ ┌──────────────────────────┐ |
| 22 | +│ OGS game definition │──export──→ │ Canvas Petri dish viz │ |
| 23 | +│ gds-sim population │ (JSON) │ Mermaid diagrams │ |
| 24 | +│ gds-psuu sweeps │ │ Narrative chapters │ |
| 25 | +│ Nash/dominance calc │ │ Pyodide PSUU sandbox │ |
| 26 | +└──────────────────────┘ └──────────────────────────┘ |
| 27 | +``` |
| 28 | + |
| 29 | +**Pipeline**: Python data generation using `gds-games`, `gds-sim`, `gds-psuu`, and `gds-viz`. Produces JSON artifacts consumed by the frontend. |
| 30 | + |
| 31 | +**Site**: Vite-based JavaScript frontend with Canvas rendering, responsive chapter navigation, and browser-side Python execution via Pyodide. |
| 32 | + |
| 33 | +## Six Showcase Views |
| 34 | + |
| 35 | +Each page presents the same underlying Prisoner's Dilemma model through a different analytical lens: |
| 36 | + |
| 37 | +| View | What It Shows | GDS Package | |
| 38 | +|------|---------------|-------------| |
| 39 | +| **Story** | Narrative chapters with interactive sandbox simulation | Strategy definitions from OGS | |
| 40 | +| **Formal Structure** | Canonical `h = f . g` decomposition | `GDSSpec` + `project_canonical()` | |
| 41 | +| **Visualizations** | Mermaid diagrams across 6 view types | `gds-viz` on `SystemIR` | |
| 42 | +| **Simulation** | Population trajectory tracking over generations | `gds-sim` | |
| 43 | +| **Nash Analysis** | Equilibria and dominance calculations | `PatternIR` from `gds-games` | |
| 44 | +| **PSUU** | Interactive parameter space exploration | `gds-psuu` via Pyodide | |
| 45 | + |
| 46 | +## GDS Ecosystem Integration |
| 47 | + |
| 48 | +gds-axelrod exercises four GDS packages together, demonstrating the composability of the ecosystem: |
| 49 | + |
| 50 | +- **gds-games** (`ogs`) — defines the game as an OGS pattern, compiles to `PatternIR` and `GDSSpec` |
| 51 | +- **gds-viz** (`gds_viz`) — renders Mermaid diagrams from the compiled `SystemIR` |
| 52 | +- **gds-sim** (`gds_sim`) — runs population dynamics simulation over iterated tournament rounds |
| 53 | +- **gds-psuu** (`gds_psuu`) — parameter sweeps compiled to WebAssembly via Pyodide for in-browser execution |
| 54 | + |
| 55 | +## Key Patterns Demonstrated |
| 56 | + |
| 57 | +### Specification as Single Source of Truth |
| 58 | + |
| 59 | +The OGS game definition is written once. Every view — visualization, simulation, equilibrium analysis, parameter exploration — derives from the same specification. No view has a private copy of the model. |
| 60 | + |
| 61 | +### Thin Projections |
| 62 | + |
| 63 | +Each analytical tool is a thin projection over the specification: |
| 64 | + |
| 65 | +- `PatternIR` → Nash equilibria via Nashpy |
| 66 | +- `PatternIR` → payoff matrix → tournament simulation |
| 67 | +- `SystemIR` → Mermaid diagrams via gds-viz |
| 68 | +- `GDSSpec` → canonical decomposition |
| 69 | + |
| 70 | +### Browser-Side Computation |
| 71 | + |
| 72 | +The PSUU page compiles Python (gds-sim + gds-psuu) to WebAssembly via Pyodide, enabling interactive parameter exploration without a backend server. |
| 73 | + |
| 74 | +## Related |
| 75 | + |
| 76 | +- [Interoperability Guide](../guides/interoperability.md) — the specification-as-interoperability-layer pattern |
| 77 | +- [Evolution of Trust](../examples/examples/evolution-of-trust.md) — the in-repo tutorial model that gds-axelrod builds upon |
| 78 | +- [Prisoner's Dilemma](../examples/examples/prisoners-dilemma.md) — the base GDS framework version |
| 79 | +- [View Stratification](../guides/view-stratification.md) — the theoretical basis for "one model, many views" |
0 commit comments