When an ant finds a piece of food, it carries the food back to the nest, dropping a chemical as it moves. When other ants "sniff" the chemical, they follow the chemical toward the food. As more ants carry food to the nest, they reinforce the chemical trail.
setup
button to set up ant nest (in violet, at
center) and three pieces of food (in blue). Click the go
button to start the simulation. The chemical is shown in green.
The evaporation-rate
slider controls the evaporation rate
of the chemical. The diffusion-rate
slider controls the
diffusion rate of the chemical.
Once the colony finishes collecting the closest food, the chemical trail to that food naturally disappears, freeing up ants to help collect the other food sources. The more distant food sources require a larger "critical number" of ants to form a stable trail.
In this project, the ants use a "trick" to find their way back to the nest: they follow the "nest scent." Real ants use a variety of different approaches to find their way back to the nest. Try to implement some alternative strategies.
uphill-chemical
procedure, the ant "follows the
gradient" of the chemical. That is, it "sniffs" in three directions,
then turns in the direction where the chemical is strongest. You might
want to try variants of the uphill-chemical
procedure,
changing the number and placement of "ant sniffs."