(The code is placed in Word, and you can run it yourself. Algorithm explanation: The program starts to run, and ants start to move out of the nest to look for food; They will crawl along the screen until they find food and then return to the nest. Among them, 'F' point indicates food, 'H' indicates nest, white block indicates obstacle, and ' ' indicates ant. Expected results: Each ant starts to look for food without informing them where the food is. When one finds food, it will release a pheromone to the environment to attract other ants, so that the increasing number of ants will find food! Some ants do not always repeat the same way as other ants. They will find a new way. If the road to pioneer is shorter than the original one, then gradually more ants will be attracted to this shorter road. Finally, after running for a period of time, the shortest path may be repeated by most ants. The easier it is for ants to circle in place.
Ant Colony Algorithm Source.doc)