# GardenArena — Beat Dry Patience (365-Day Bamboo Challenge)

Mission: Contain running bamboo for 365 simulated days, preserve vitality and save water & labor. Criteria are compared in strict lexicographic order, never summed into a composite score.
This challenge is a bounded SIMULATION, outside any official closed season. Iterations are allowed and recorded as open_book_iterative. The reference policy (Inaugural Dry Patience) was written by a human operator, not an attested AI identity.

Return ONLY a GardenScript 0.5 program targeting `domain bamboo`, `ruleset: bamboo.v1`.
All five channels (`monitoring`, `containment`, `barrier`, `canopy`, `irrigation`) are mandatory. No external code, network, loops or libraries.

Scenario: bamboo-underground-365d-v1, SHA-256 45f60bca9e50f8d128a2571b570a6fc683f8799e9cfc3580c77c947ce3d9d275.
Engine: garden-bamboo-v0.6. Horizon: 365 days.
Identical budgets: 600 mm water, 2500 min labor, 6 barrier repairs.
Shared stress schedule: drought D130–165, flash flood D220–224, windstorm D252–253, damaged joint D254. Synthetic scenario assumptions, not a real-world forecast.

Lexicographic tie-break order: rankable, final escaped tips at D365 (lower), days uncontained over the year (lower), containment permille (higher), minimum vitality pct (higher), living canes (higher), final vitality pct (higher), labor used (lower), water used (lower).
Saving water never compensates for losing an earlier criterion.

Web challenge: https://gardenarena.io/en/challenge/bamboo
Full scenario JSON: https://gardenarena.io/api/training/scenario
MCP flow: bamboo_challenge_get -> validate_gardenscript -> bamboo_training_run -> bamboo_training_explain -> bamboo_training_artifact.
Ask the user for confirmation before consuming a run. Keep run_token private; never publish code or results without explicit human action. Quota: 6 runs/h per client, 36/h global (shared web/MCP). Explain outcomes strictly from the Rust trace.

## Exact reference source (Inaugural Dry Patience)

SHA-256: b32d8c89afde1a5848e7cd2c9ef175d98e85384a6ee9d32f703be949c6e20a94

```garden
garden "Inaugural Dry Patience" version 0.5
domain bamboo
ruleset: bamboo.v1
decide monitoring:
  when rhizome.outside_active_tips_count >= 2count => full_perimeter
  when history.days_since_monitoring_day >= 21day => barrier_probe
  otherwise => surface_scan
decide containment:
  when rhizome.detected_outside_tips_count >= 2count and resource.labor_left_min >= 90min => excavate_detected_sector
  when rhizome.detected_outside_tips_count >= 1count and resource.labor_left_min >= 30min => cut_detected_tip
  otherwise => observe
decide barrier:
  when barrier.joint_integrity_pct <= 50% and resource.patch_left_count >= 1count => repair_worst_joint
  when history.days_since_monitoring_day >= 28day => inspect_joints
  otherwise => none
decide canopy:
  when cane.mature_count >= 11count and resource.labor_left_min >= 45min => harvest_mature_canes
  when cane.living_count >= 30count => thin_old_canes
  otherwise => keep
decide irrigation:
  when soil.water_pct <= 28% and resource.water_left_mm >= 30mm => 5mm
  when soil.water_pct <= 36% and weather.rain_7d_mm <= 4mm => 2mm
  otherwise => 0mm
```

## Full GardenScript v0.5 specification

# GardenScript 0.5 — `bamboo.v1`

GardenScript 0.5 est le profil fermé du moteur bambou. Le compilateur Rust de
`src/gardenscript_bamboo.rs` est l'unique implémentation normative. Ce langage
ne décrit pas une vérité botanique : il transforme un instantané borné du
simulateur en intentions de gestion auditables.

## Enveloppe obligatoire

```garden
garden "Nom ASCII" version 0.5
domain bamboo
ruleset: bamboo.v1
```

Les cinq blocs sont obligatoires, uniques et dans cet ordre : `monitoring`,
`containment`, `barrier`, `canopy`, `irrigation`. Chaque bloc contient de 1 à
10 branches `when`, puis exactement un `otherwise`. Une branche contient de 1
à 8 prédicats reliés uniquement par `and`. Les opérateurs autorisés sont `<`,
`<=`, `>`, `>=`, `==`. La première branche vraie gagne.

```garden
decide monitoring:
  when rhizome.outside_active_tips_count >= 1count => full_perimeter
  otherwise => surface_scan
```

Il n'existe ni boucle, ni variable mutable, ni fonction, ni import, ni accès à
l'heure réelle, ni hasard, ni fichier, ni processus, ni réseau. La source est
limitée à 16 Kio. Le budget statique et VM est de 512 unités.

## Actions bornées

| Canal | Sorties autorisées |
|---|---|
| `monitoring` | `surface_scan`, `barrier_probe`, `full_perimeter` |
| `containment` | `observe`, `cut_detected_tip`, `excavate_detected_sector` |
| `barrier` | `none`, `inspect_joints`, `repair_worst_joint` |
| `canopy` | `keep`, `thin_old_canes`, `harvest_mature_canes` |
| `irrigation` | quantité de `0mm` à `20mm` |

Le noyau de sûreté du runner peut refuser une intention : aucune coupe ou
excavation n'agit sur un rhizome non détecté, aucune récolte ne prend une canne
immature et aucun solde de ressource ne devient négatif. Le replay conserve la
décision demandée, la décision acceptée et la raison du repli.

## Les 24 capteurs

Les valeurs sont décimales à trois chiffres au plus et portent obligatoirement
leur unité.

| Capteur | Unité | Domaine DSL |
|---|---:|---:|
| `clock.day` | `day` | 0–366 |
| `calendar.season_progress_pct` | `%` | 0–100 |
| `weather.rain_7d_mm` | `mm` | 0–2 000 |
| `soil.water_pct` | `%` | 0–100 |
| `colony.vitality_pct` | `%` | 0–100 |
| `rhizome.active_tips_count` | `count` | 0–1 000 |
| `rhizome.segment_count` | `count` | 0–100 000 |
| `rhizome.max_spread_cm` | `cm` | 0–10 000 |
| `rhizome.max_depth_cm` | `cm` | 0–500 |
| `rhizome.nearest_barrier_cm` | `cm` | 0–10 000 |
| `rhizome.barrier_contacts_30d_count` | `count` | 0–1 000 |
| `rhizome.outside_active_tips_count` | `count` | 0–1 000 |
| `rhizome.detected_outside_tips_count` | `count` | 0–1 000 |
| `barrier.min_depth_cm` | `cm` | 0–500 |
| `barrier.exposed_lip_cm` | `cm` | 0–100 |
| `barrier.joint_integrity_pct` | `%` | 0–100 |
| `cane.shoots_count` | `count` | 0–1 000 |
| `cane.living_count` | `count` | 0–1 000 |
| `cane.mature_count` | `count` | 0–1 000 |
| `history.days_since_monitoring_day` | `day` | 0–366 |
| `history.days_since_cut_day` | `day` | 0–366 |
| `resource.water_left_mm` | `mm` | 0–2 000 |
| `resource.labor_left_min` | `min` | 0–100 000 |
| `resource.patch_left_count` | `count` | 0–1 000 |

L'observation doit contenir ces 24 capteurs exactement une fois. Un capteur
inconnu, absent, mal typé ou hors borne invalide l'évaluation.

## Déterminisme et scellement

- `source_sha256` hache les octets UTF-8 exacts de l'auteur ;
- `program_sha256` hache l'IR JSON canonique ;
- une évaluation renvoie cinq décisions et cinq preuves `DecisionTrace` ;
- chaque preuve indique la branche choisie et les témoins de prédicat visités ;
- le moteur n'effectue aucun appel LLM ou réseau.

Validation :

```bash
cargo run --quiet --bin garden-script -- \
  validate examples/bamboo_containment_v05.garden
```

Arène souterraine complète :

```bash
cargo run --release --bin garden-bamboo -- \
  examples/bamboo_request_2_strategies_v05.json
```

Le profil compile une politique. Seul `garden-bamboo` lui fournit le scénario,
la géométrie, les ressources et les hypothèses du modèle.

