Hawk-Dove Game: When Does Fighting Pay?

Hawk-Dove game theory simulation of the evolutionarily stable strategy: when a fight costs more than the prize, Hawks and Doves settle into a stable mix; cheapen the fight below the prize and the population escalates into all-out war.

Level: Advanced

game-theoryevolutionary-gamemixed-strategyequilibriumconflictcooperationreplicator-dynamicsreinforcing-loopbalancing-loop

  • Stocks: hawk population
  • Flows: switches to Hawk, switches to Dove
  • Feedback Loops: imitation of success (reinforcing), frequency-dependent payoff (balancing)
  • Probes: hawk_fraction, avg_payoff, conflict_cost, hawk_advantage

Feedback Loops

Understand the balancing and reinforcing feedback loops that drive system behavior and create complex dynamics in systems thinking.

Take the Quiz

Emergence

Discover how interactions between parts can create properties and behaviors that no individual component possesses alone.

Take the Quiz

System Archetypes

Learn recurring structural patterns like Limits to Growth, Fixes That Fail, and Tragedy of the Commons, plus high-leverage interventions.

Take the Quiz
simulation.py

Hawk–Dove: when does a population stop fighting?

A population of agents pairs off at random to contest a resource worth value. Each plays Hawk (escalate and fight) or Dove (display, then yield), and copies whoever just earned more.

The knob is fight_cost, and the tipping point is fight_cost = value. Above that line Hawks settle near value / fight_cost. Below it, Hawk takes over and the contest becomes an arms race.


import random
from tys import probe, progress


def simulate(cfg: dict):

    value = cfg["value"]              # worth of the contested resource (V)
    fight_cost = cfg["fight_cost"]    # value two Hawks burn in a fight (C)
    generations = int(cfg["generations"])
    exploration = cfg.get("exploration", 0.002)  # chance an agent re-rolls its strategy
    survive_cut = cfg.get("dove_survival_fraction", 0.1)  # Doves "survive" above this share

Seed inside simulate so every browser Run is reproducible and the two configs differ only by fight_cost, never by the luck of the draw.

    rng = random.Random(cfg.get("seed", 7))

The stable Hawk share is V/C, and it caps at 1 once fighting is so cheap that escalating always pays (C <= V), including a free fight.

    predicted = 1.0 if fight_cost <= 0 else min(1.0, value / fight_cost)

Contests need pairs. A leftover agent would sit the round out, miss the payoff totals, and break avg_payoff + conflict_cost = value/2, so an odd playground population quietly drops one agent.

    population = int(cfg["population"])
    if population % 2:
        population -= 1

    if population < 2 or generations < 1:
        progress(100, "Need at least one pair of agents")
        for name in ("hawk_fraction", "avg_payoff", "conflict_cost", "hawk_advantage"):
            probe(name, 0, 0.0)
        return {
            "final_hawk_fraction": 0.0,
            "predicted_hawk_fraction": predicted,
            "doves_survive": False,
            "avg_conflict_cost": 0.0,
        }

Start from the same mix in both configs, so the split outcome is a consequence of fight_cost alone.

    initial = min(1.0, max(0.0, float(cfg.get("initial_hawks", 0.5))))
    n_hawks = int(round(population * initial))
    hawks = [i < n_hawks for i in range(population)]
    rng.shuffle(hawks)

Widest gap between two payoffs. Dividing by it keeps the chance of copying a richer neighbor inside 0 to 1.

    spread = (abs(value) + abs(fight_cost)) / 2 or 1.0

Payoff to the row player in one contest.

    def payoff(me_hawk, you_hawk):
        if me_hawk and you_hawk:
            return (value - fight_cost) / 2   # both escalate: split the prize, pay the fight
        if me_hawk:
            return value                       # Hawk takes the prize from a Dove
        if you_hawk:
            return 0.0                         # Dove yields and walks away with nothing
        return value / 2                       # two Doves share the prize

    history = []
    for g in range(generations):

Randomly pair the whole population and let every pair contest.

        order = list(range(population))
        rng.shuffle(order)
        gains = [0.0] * population
        hawk_pay = dove_pay = 0.0
        conflict = 0.0
        for k in range(0, population, 2):
            a, b = order[k], order[k + 1]
            gains[a] = payoff(hawks[a], hawks[b])
            gains[b] = payoff(hawks[b], hawks[a])
            if hawks[a] and hawks[b]:
                conflict += fight_cost          # value destroyed by this fight
            for who in (a, b):
                if hawks[who]:
                    hawk_pay += gains[who]
                else:
                    dove_pay += gains[who]

        hawk_share = sum(hawks) / population

avg_payoff (value kept) and conflict_cost (value burned) always sum to value/2 per agent: together they account for the whole prize. hawk_advantage is the expected Hawk-minus-Dove payoff at this mix, (V - p*C) / 2. It stays positive while aggression invades and crosses zero at the stable share p = V/C.

        probe("hawk_fraction", g, hawk_share)
        probe("avg_payoff", g, (hawk_pay + dove_pay) / population)
        probe("conflict_cost", g, conflict / population)
        probe("hawk_advantage", g, (value - hawk_share * fight_cost) / 2)
        history.append(hawk_share)

Imitation plus a little exploration. An agent who spots a richer peer copies that strategy with probability proportional to the payoff gap. A rare re-roll keeps one unlucky generation from erasing a strategy that the balance would otherwise sustain.

        new_hawks = hawks[:]
        for i in range(population):
            j = rng.randrange(population)
            gap = gains[j] - gains[i]
            if gap > 0 and rng.random() < min(1.0, gap / spread):
                new_hawks[i] = hawks[j]
            elif rng.random() < exploration:
                new_hawks[i] = rng.random() < 0.5
        hawks = new_hawks

        if g == 0:
            progress(int(100 * (g + 1) / generations), "Agents pair off and contest the prize")
        elif g + 1 == generations // 2:
            progress(int(100 * (g + 1) / generations), "Imitation is pulling the mix toward its stable share")
        elif g + 1 == generations:
            progress(100, "The population has settled")
        else:
            progress(int(100 * (g + 1) / generations))

Average the Hawk share over the final stretch so the steady state is read off a settled population, not one noisy generation.

    tail = history[-max(1, generations // 10):]
    final_hawk = sum(tail) / len(tail)
    return {
        "final_hawk_fraction": final_hawk,
        "predicted_hawk_fraction": predicted,
        "doves_survive": (1 - final_hawk) > survive_cut,
        "avg_conflict_cost": conflict / population,
    }


def requirements():
    return {"external": []}
All-Out War.yaml
# escalation.yaml — the default, set just past the C = V tipping point.
# A fight (45) costs slightly less than the prize (50), so escalating always
# pays. Hawks take over and Doves are driven out: all-out war.
value: 50
fight_cost: 45
population: 200
generations: 150
initial_hawks: 0.5
exploration: 0.002
dove_survival_fraction: 0.1
seed: 7
Charts (All-Out War)

hawk_fraction

Share playing Hawk: All-Out War climbs toward everyone, while Stable Mix levels off near value/fight_cost, about a quarter of the population.

Samples150 @ 0.00–149.00
Valuesmin 0.50, mean 0.95, median 0.97, max 0.99, σ 0.07

avg_payoff

Prize each agent keeps, which falls as Hawk-Hawk fights multiply and always sums with conflict cost to value/2.

Samples150 @ 0.00–149.00
Valuesmin 2.73, mean 4.37, median 3.63, max 19.15, σ 2.67

conflict_cost

Prize burned per agent when two Hawks fight: most of the resource in All-Out War, and only a small slice in Stable Mix.

Samples150 @ 0.00–149.00
Valuesmin 5.85, mean 20.63, median 21.38, max 22.27, σ 2.67

hawk_advantage

Expected Hawk payoff minus expected Dove payoff, positive while aggression spreads and zero at the stable share value/fight_cost.

Samples150 @ 0.00–149.00
Valuesmin 2.61, mean 3.52, median 3.06, max 13.75, σ 1.66
Final Results (All-Out War)
MetricValue
final_hawk_fraction0.97
predicted_hawk_fraction1.00
doves_survivefalse
avg_conflict_cost20.48
Stable Mix.yaml
# coexistence.yaml — the contrast. Identical to escalation.yaml except
# fight_cost: a fight (200) now costs far more than the prize (50). Hawks
# self-limit near the stable share V/C = 0.25 and live alongside Doves.
value: 50
fight_cost: 200
population: 200
generations: 150
initial_hawks: 0.5
exploration: 0.002
dove_survival_fraction: 0.1
seed: 7
Charts (Stable Mix)

hawk_fraction

Share playing Hawk: All-Out War climbs toward everyone, while Stable Mix levels off near value/fight_cost, about a quarter of the population.

Samples150 @ 0.00–149.00
Valuesmin 0.20, mean 0.28, median 0.28, max 0.50, σ 0.05

avg_payoff

Prize each agent keeps, which falls as Hawk-Hawk fights multiply and always sums with conflict cost to value/2.

Samples150 @ 0.00–149.00
Valuesmin -1.00, mean 17.27, median 18.00, max 23.00, σ 3.67

conflict_cost

Prize burned per agent when two Hawks fight: most of the resource in All-Out War, and only a small slice in Stable Mix.

Samples150 @ 0.00–149.00
Valuesmin 2.00, mean 7.73, median 7.00, max 26.00, σ 3.67

hawk_advantage

Expected Hawk payoff minus expected Dove payoff, positive while aggression spreads and zero at the stable share value/fight_cost.

Samples150 @ 0.00–149.00
Valuesmin -25.00, mean -3.08, median -2.50, max 5.50, σ 4.60
Final Results (Stable Mix)
MetricValue
final_hawk_fraction0.28
predicted_hawk_fraction0.25
doves_survivetrue
avg_conflict_cost10.00
FAQ
What is the tipping point between all-out war and a stable mix?
Hawk-Dove, also called Chicken, is Maynard Smith's model of a contest where mutual aggression is the worst outcome. Two Hawks each expect (value - fight_cost) / 2, which is positive only when fight_cost is below value. Below that line Hawk is strictly dominant and Doves are driven out. Above it the evolutionarily stable Hawk share is value/fight_cost. The default fight costs 45 against a prize of 50, so the population escalates. The contrast raises only the fight cost to 200, and Hawks settle near 0.25. Nobody chooses that mix. It emerges because each agent only copies a neighbor who just did better.
Why do Hawks stop spreading once fighting is costly?
Payoff depends on how common Hawks already are. A rare Hawk mostly meets Doves and takes the whole prize, so imitation spreads aggression: a reinforcing loop. A common Hawk mostly meets other Hawks and pays the fight cost, so Doves earn more and spread back: a balancing loop. Those loops meet at value/fight_cost instead of letting either strategy take over.
Why does making the fight slightly cheaper cause all-out war?
At fight_cost 45 and value 50, escalating still beats yielding even against another Hawk, because (50 - 45) / 2 is positive. The balancing loop disappears. Imitation then turns almost the whole population into Hawks, and the hawk_fraction line sits near 1 while the same run with a costlier fight sits near 0.25.
Where does this show up outside the model?
Hawk is refusing to swerve and Dove is swerving, so this is the game of Chicken. It is also why most animal fights are ritualized displays rather than lethal combat: an injury that costs more than the territory or the mate is not worth it. Brinkmanship, price wars, and strikes escalate the same way when the cost of clashing is low relative to the stake, and they keep a stable minority of hard-liners when clashing is expensive.
Why do average payoff and conflict cost move as mirror images?
Every contest divides the prize between value the players keep and value a fight burns, so per agent avg_payoff + conflict_cost = value/2 (here, 25). Conflict cost is the share of the resource destroyed: most of the 25 in All-Out War, a small slice in Stable Mix.