Skip to content

Commit 5cef2d4

Browse files
Merge pull request #129 from BlockScience/docs/case-study-axelrod
docs: add gds-axelrod case study
2 parents 9172030 + d1e92d9 commit 5cef2d4

3 files changed

Lines changed: 92 additions & 0 deletions

File tree

docs/case-studies/axelrod.md

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
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"

docs/case-studies/index.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Case Studies
2+
3+
Real-world projects built on the GDS ecosystem, demonstrating how compositional specifications translate into interactive applications, research tools, and educational platforms.
4+
5+
| Project | Domain | GDS Packages Used | Description |
6+
|---------|--------|-------------------|-------------|
7+
| **[Axelrod Tournament](axelrod.md)** | Game Theory | gds-games, gds-sim, gds-psuu, gds-viz | Interactive exploration of the iterated Prisoner's Dilemma through six analytical views |

mkdocs.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,9 @@ plugins:
114114
- {psuu/getting-started.md: "Installation + first parameter sweep"}
115115
- psuu/guide/*.md
116116
- psuu/api/*.md
117+
Case Studies:
118+
- {case-studies/index.md: "Real-world projects built on the GDS ecosystem"}
119+
- {case-studies/axelrod.md: "Axelrod tournament — one model, many views with gds-games, gds-sim, gds-psuu, gds-viz"}
117120
Ecosystem:
118121
- {framework/ecosystem.md: "All packages, their imports, and dependency relationships"}
119122

@@ -332,6 +335,9 @@ nav:
332335
- gds_psuu.optimizers: psuu/api/optimizers.md
333336
- gds_psuu.sweep: psuu/api/sweep.md
334337
- gds_psuu.results: psuu/api/results.md
338+
- Case Studies:
339+
- case-studies/index.md
340+
- Axelrod Tournament: case-studies/axelrod.md
335341
- Design & Research:
336342
- Layer 0 Milestone: guides/architecture-milestone-layer0.md
337343
- DSL Roadmap: guides/dsl-roadmap.md

0 commit comments

Comments
 (0)