# Generator Scoring Algorithm Reference

Session: 2026-06-17

## Weather Scoring

```python
if temp >= 35:
    if is_cold: score += 5.0
    if hot_cooking: score -= 4.0
    if not is_cold: score -= 2.0  # blanket
    if fish and day_index >= 4: score -= 4.0

elif temp >= 30:
    if is_cold: score += 4.0
    if hot_cooking: score -= 2.5
    if soup: score -= 3.0
    if fish and day_index >= 4: score -= 3.0
```

**Critical pitfall learned:** Without blanket `-2.0` on non-cold meals at >=35°C, family-preference scores (+1.5 Asian) can overpower weather penalties. Result: Carbonara at 37°C.

## Perishability Scoring

```python
if perishable or (fresh and 'salat' in tags):
    if day_index <= 2:     score += 2.5
    elif day_index >= 4:   score -= 3.0
    elif day_index == 3:   score -= 1.0
```

User example: "Lachs vom Samstag ist am Donnerstag schlecht."

## Tag Taxonomy

- **Cold:** salat, bowl, frisch, roh, griechisch, mediterran
- **Hot cooking:** pasta, nudeln, ofen, eintopf, curry, schmor, gratin, hackfleisch
- **Perishable:** fisch, lachs, thunfisch, kräuter, minze, koriander, basilikum, rucola, spinat
- **Fresh:** salat, tomate, gurke, avocado

## Complete Code

See `scripts/nutrition-plan-generator-v3.py` — full implementation with all scoring dimensions.
