This applet shows a behavioural ant simulation.
The simulation works by first creating a few anthills in the plane. From each one of them, a crowd of ants spawns and starts wandering erratically while looking for food (white circles). When a given ant eventually finds food, it’ll walk straight back to its nest, leaving a trail of pheromones behind. These pheromones can be detected by nearby ants, which will tend to follow the trail; the pheromones are volatile, and will soon dissipate unless the trail is reinforced by more ants carrying food.
Most efficient paths from each anthill to the food tend to emerge from these pheromone trails.
White = food. Black = ant. Gray = pheromones.
Built with Processing - Any key to reset simulation