Each ant leaves the nest and wanders, biased toward whatever pheromone concentration it senses just ahead. Ants that reach the food turn back toward the nest and lay a strong pheromone trail along the way; ants still searching lay a much weaker one. Every cell of the pheromone field decays exponentially each frame.
- Deposit:
τ(x,y) += Q where Q is the deposit strength (stronger for ants carrying food)
- Evaporation:
τ(x,y) *= e^(−ρ·dt) every frame, ρ = evaporation rate
- Steering: an ant samples τ along three forward rays and turns probabilistically toward the strongest one, mixed with random exploration noise
A wall with two gaps of different length separates nest and food — this is the classic "double bridge" experiment: because ants using the shorter gap complete round trips faster, that path accumulates pheromone faster and is reinforced before it can evaporate, so the colony converges on the shorter route purely through local trail-following, with no ant ever comparing distances.