Click flag. Ants move randomly until they find food (green). Then they leave pheremone (red) and head to the nest (orange) to drop off food. Ants follow pheremone. That leads others to food. Once a food source is eaten, ants move randomly until they find new food.
After dropping food off at the nest ants stop leaving pheremone but in fact kick up and effectively erase any pheremone they touch. That allows them to start fresh and search for new food. This is a kind of swarm intellegence, or self-organizing system. Ants wander randomly until they find red. Then if left antenna is on red they move right. If right antenna is on red they move left. (left antenna is painted a different color than right). If ant meets another head on, detecting head of another ant, it turns around. These negative feedback loops eventually result in ants following the red line. We randomly place the nest and food.