This tutorial walks you through using the normal-form game solver to find Nash equilibria, then setting up repeated-game policies to manage ongoing strategic interactions.

## Prerequisites

- A Mieza account ([Sign up here](https://mieza.ai/signup))
- For the API examples: an API token (see [API Access Tokens](/docs/api-tokens))

## Part 1: Solving a Game in the Browser

### 1. Navigate to the Solver

From the main navigation, go to **GTO → Solve**, or visit [mieza.ai/gto/solve](https://mieza.ai/gto/solve) directly.

### 2. Define Your Game

Enter the game details:

- **Players**: Name the two players (e.g., "Alice" and "Bob")
- **Actions**: List each player's available actions
- **Payoffs**: For every combination of actions, enter each player's payoff

**Example — Prisoner's Dilemma:**

| | Cooperate | Defect |
|---|---|---|
| **Cooperate** | -1, -1 | -3, 0 |
| **Defect** | 0, -3 | -2, -2 |

### 3. Read the Results

The solver returns:

- **Equilibria**: Each Nash equilibrium with the probability each player assigns to each action
- **Expected payoffs**: What each player earns at equilibrium
- **Strategy type**: Whether the equilibrium uses pure strategies (100% on one action) or mixed strategies (probabilities across multiple actions)

In the Prisoner's Dilemma, the unique equilibrium is both players choosing Defect with probability 1 — a pure strategy equilibrium.

## Part 2: Persisting Games and Recording Plays

If you want to track a game over time — recording rounds and assigning policies — you'll use the authenticated API.

### 1. Create a Persistent Game

Save your game so it can accumulate play history:

```bash
curl -X POST https://mieza.ai/v1/games/nf \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "game": {
      "players": ["Alice", "Bob"],
      "actions": {"Alice": ["Cooperate", "Defect"], "Bob": ["Cooperate", "Defect"]},
      "payoffs": {
        "Cooperate,Cooperate": [-1, -1],
        "Cooperate,Defect": [-3, 0],
        "Defect,Cooperate": [0, -3],
        "Defect,Defect": [-2, -2]
      }
    },
    "name": "Prisoner Dilemma",
    "description": "Classic cooperation vs. defection"
  }'
```

The response includes a `game_id` you'll use for all subsequent operations.

### 2. Assign Policies

Bind a strategy to each player:

```bash
# Alice plays Tit-for-Tat
curl -X POST https://mieza.ai/v1/games/nf/GAME_ID/policies \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "player": "Alice",
    "policy_key": "tit-for-tat",
    "config": {"default-action": "Cooperate"}
  }'
```

Save the returned `assignment_id`.

### 3. Query "What Should I Do?"

Before each round, ask the platform for the recommended action:

```bash
curl -X POST https://mieza.ai/v1/games/nf/GAME_ID/policies/ASSIGNMENT_ID/next \
  -H "Authorization: Bearer YOUR_TOKEN"
```

The response includes the recommended action, the reasoning behind it, and (for mixed strategies) the full probability distribution.

### 4. Record What Happened

After each round, record the actual actions:

```bash
curl -X POST https://mieza.ai/v1/games/nf/GAME_ID/play \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "actions": {"Alice": "Cooperate", "Bob": "Cooperate"},
    "title": "Round 1"
  }'
```

The platform computes and stores the realized payoffs. Future policy queries automatically incorporate this new history.

## Part 3: Available Policies

To see all available policies and their configuration options:

```bash
curl https://mieza.ai/v1/policies/catalog
```

Each policy entry includes a description, its category, and any configurable parameters.

## Next Steps

- [What are Repeated-Game Policies?](/docs/what-are-repeated-game-policies) — deeper explanation of the policy system
- [MCP Integration Guide](/docs/mcp-integration) — use the solver directly from Cursor or Claude Desktop
- [API Overview](/docs/api-overview) — full API authentication and conventions
