# Watershed Parity Matrix — v0.1

**Purpose:** Keep the CookieBlob room and Game Crafter prototype behaviorally identical while allowing each format to use its native interface.

## Shared normalized state

| Field | Default | Bounds | Meaning |
|---|---:|---:|---|
| `cycle` | 0 | 0+ | Completed phase resolutions |
| `phase` | `W01` | W01–W10 | Current watershed transition |
| `health` | 3 | 0–5 | Basin resilience; at 0, play is exhausted |
| `flow` | 3 | 0–6 | Water / information movement available |
| `cloud` | 0 | 0–6 | Moisture / latent possibility held aloft |
| `pollution` | 0 | 0–6 | Accumulated contamination / noise |
| `energy` | 3 | 0–6 | Capacity to transform or move state |
| `groundwater` | 2 | 0–6 | Deep reserve |
| `reservoir` | 1 | 0–6 | Deliberate surface storage |
| `pressure` | 0 | 0–6 | Unresolved accumulation; high pressure is risky |
| `trace` | `[]` | last 12 events | Human-readable history of resolutions |

## Phase map

| ID | Phase | Primary zone | Transition question | Status |
|---|---|---|---|---|
| W01 | Evaporate | Ocean → Clouds | Can energy lift available water / information? | Active |
| W02 | Condense | Clouds → Soil Surface | Can held possibility become a usable drop? | Active |
| W03 | Precipitate | Soil Surface | Where does the drop land? | Reserved |
| W04 | Infiltrate | Soil Surface → Groundwater | What enters the deep reserve? | Reserved |
| W05 | Runoff | Soil Surface → Creeks / Rivers | What moves across the surface? | Reserved |
| W06 | Streamline | Creeks / Rivers | Which path carries the flow? | Reserved |
| W07 | Store | Lakes / Reservoirs | What is held deliberately? | Reserved |
| W08 | Pollute / Filter | Any basin zone | What degrades or clarifies the stream? | Reserved |
| W09 | Use / Return | Basin → Return | What is spent, and what comes back? | Reserved |
| W10 | Recycle | Return → Ocean | What closes the loop? | Reserved |

## Active action rules

### W01 — Evaporate

**Action:** Spend energy to lift one unit of flow into cloud.

**Requirement:** `energy >= 1` and `flow >= 1`.

**Success deltas:**

- `energy -1`
- `flow -1`
- `cloud +1`
- `pressure -1`
- `cycle +1`
- `phase → W02`

**Blocked result:** If the requirement fails, no resource changes. Append a blocked trace event. The phase remains W01.

**Trace event:** `W01 success: one unit lifted into cloud` or `W01 blocked: need energy and flow`.

### W02 — Condense

**Action:** Convert one cloud unit into a ground-facing drop.

**Requirement:** `cloud >= 1`.

**Success deltas:**

- `cloud -1`
- `flow +1`
- `pressure +1`
- `cycle +1`
- `phase → W03`

**Blocked result:** If no cloud is available, no resource changes. Append a blocked trace event. The phase remains W02.

**Trace event:** `W02 success: cloud became a drop` or `W02 blocked: need cloud`.

## Reducer contract

Both formats resolve an action in this order:

1. normalize input;
2. check current phase;
3. check requirements;
4. apply all success deltas atomically, or no resource deltas on block;
5. clamp each bounded meter;
6. increment `cycle` only on success;
7. advance phase only on success;
8. append exactly one trace event;
9. retain only the most recent 12 trace events.

## Fixture tests

These fixtures are intentionally small and should be run in both formats.

### F01 — Fresh W01 success

**Input:** defaults.  
**Action:** W01.  
**Expected:** `phase=W02`, `cycle=1`, `energy=2`, `flow=2`, `cloud=1`, `pressure=0`, `health=3`, `pollution=0`.

### F02 — W01 blocked by empty energy

**Input:** defaults with `energy=0`.  
**Action:** W01.  
**Expected:** phase remains W01; cycle remains 0; flow remains 3; cloud remains 0; trace gets one blocked event.

### F03 — W02 success after W01

**Input:** F01 result.  
**Action:** W02.  
**Expected:** `phase=W03`, `cycle=2`, `energy=2`, `flow=3`, `cloud=0`, `pressure=1`, `health=3`, `pollution=0`.

### F04 — W02 blocked without cloud

**Input:** normalized state with `phase=W02`, `cloud=0`.  
**Action:** W02.  
**Expected:** phase remains W02; cycle unchanged; flow unchanged; pressure unchanged; trace gets one blocked event.

### F05 — Clamp on W01 success

**Input:** `phase=W01`, `energy=1`, `flow=6`, `cloud=6`, `pressure=0`, all other defaults.  
**Action:** W01.  
**Expected:** `energy=0`, `flow=5`, `cloud=6`, `pressure=0`; no value exceeds bounds; phase W02; cycle 1.

### F06 — Trace cap

**Input:** any valid state with 12 existing trace events.  
**Action:** any active action.  
**Expected:** trace length remains exactly 12 and the oldest event is removed.

## Parity checklist

- [ ] Same defaults
- [ ] Same phase IDs
- [ ] Same requirements
- [ ] Same success deltas
- [ ] Same blocked behavior
- [ ] Same bounds and clamping
- [ ] Same cycle semantics
- [ ] Same trace wording or equivalent meaning
- [ ] CookieBlob reload preserves state
- [ ] Game Crafter reset restores defaults
- [ ] Exported CookieBlob seed can be recorded on the physical seed card
