Watch
1
Fork
You've already forked adversarial_foraging
0

hawk dove algorithmic search, added spawn zone conf via deepseek

This commit is contained in:
Andy Killorin 2026-11-11 18:48:37 -05:00
commit e34c92db91
Signed by: ank
GPG key ID: 80BA307A6BD7A7E4

84
HAWK_DOVE.md Normal file
View file

@ -0,0 +1,84 @@
# Hawk–Dove phase transition for the "normal ball" weapon
## The problem
The experiment in `simulator/conf.toml` pits an aggressive team (**red**, the
hawk) against a pacifist team (**blue**, the dove). Both carry the same weapon
but only red ever fires it. With the *ball* weapon (a blast centred on the
shooter) red essentially always wins: firing is free, so any blue it kills is
pure profit. The dove never inherits a benefit from the weapon.
We want a phase diagram where **having a weapon goes from favouring the hawk to
favouring the dove** — i.e. a region where the armed aggressor wins and a region
where the unarmed pacifist wins, with a real boundary between them.
## Game theory: escalation with a collateral cost
This is the classic **Hawk–Dove** game. A hawk's payoff for escalating is the
value `V` of what it wins; the cost is `C`, the damage the fight does to the
hawk itself. Escalation is favoured while `V > C` and stops paying once
`C > V`.
The ball weapon gives a natural, tunable `C`: the blast is centred on the
*shooter*, so it also hits
* **kin** (friendly fire), and
* **food** (the blast's `peers` include food, which is killed on contact).
Both scale with the blast area, i.e. with `radius²`, while the benefit (killing
doves) saturates. Make the hawks stand close enough together and a big blast
turns the hunter into its own worst enemy — the weapon now *favours the dove*.
## Scenarios considered
| # | Idea | Outcome |
|---|------|---------|
| 1 | Keep original columns, ball weapon only | Red wins almost everywhere (the "never favours the dove" baseline). |
| 2 | Blues clustered, reds spread | Red wipes the cluster; hawk wins even harder. |
| 3 | Reds clustered, blues spread | Dove wins everywhere: hawks nuke their own pack on the first shot. |
| 4 | Clustered hawks + `kills_user = true` | Dove wins unless the blast is huge; no hawk window. |
| 5 | **Clustered hawks (moderate), scattered doves, dense food** | Red wins with a small blast, loses once friendly fire + food destruction dominate — the desired hawk→dove transition. |
Scenario 5 is the one kept. The key geometry change is the **hawk nest**: reds
start in a compact box in the middle of the food field, while doves are
scattered over the whole field.
## The chosen configuration (`ball.toml`)
* `type = "ball"`, `kills_user = false` — firing is not immediately suicidal;
the cost is purely collateral.
* `red_spawn` = 400×400 box in the field centre (the hawk nest).
* `blu_spawn` = the whole food field (doves dispersed).
* `food_spawn` = the whole food field, `food_amount = 250`.
Sweeping `(view_dist, radius)` gives:
* **low radius / enough view_dist → weapon favours the hawk.** A small blast
lets the packed hawks finish off nearby doves without hurting the nest.
* **high radius → weapon favours the dove.** The blast catches kin and
vaporises the nest's food; the scattered doves out-forage the survivors.
* insufficient `view_dist` alone also hurts red (the nest cannot range out to
food), which bends the boundary upwards as `view_dist` grows.
The boundary is robust: it barely moves when red's `kin`/`nonkin`/`none`
policies are perturbed (see the scan in the commit history / scratch work).
## Reproducing
```bash
bash run.sh
# view_dist 100:350:12.5 × radius 0:250:12.5, sigma 3, refine 1
# -> sweep_out/results.jsonl, sweep_out/results.csv, sweep_out/phase.png
```
Final run: 600 points, ~354k seeds, **red 312 / blue 214 / tie 74**. The
boundary (`mean_diff = 0`) climbs from radius ≈ 105 at `view_dist = 100` to
≈ 175 by `view_dist ≈ 200` and then flattens — a single, smooth, weapon-driven
hawk→dove frontier with a thin undecided band.
## Simulator change
Spawns were hard-coded columns. `SimConfig` now accepts three optional regions
(`blu_spawn`, `red_spawn`, `food_spawn`, each `x0/x1/y0/y1`), sampled uniformly
per seed. Omitting them reproduces the original fixed columns bit-for-bit, so
all pre-existing tests and configs still pass.