When you get a bunch of small and simple things together and give them simple commands, clear patterns of behavior begin to emerge. This is true for ant colonies, computer program logic and even cities full of people. We are finding more and more that we need more simple and basic programming and planning to achieve greater and more complex results.
Interesting tidbit: Queen ants do not direct the actions of the colony, in fact no ant is "in charge". Instead, each individual ant lays down and detect pheromone trails that indicate what is going on in the colony. If an ant detects too many pheromones from harvesting activities it will go check on the nursery. If the nursery is full of "happily taken care of" pheromones then it will check on the gardens. Using this system of pheromones, the ants can quickly adapt to the changing needs of the colony. Additionally, the system is self healing because no single ants (or small collection of them) calls the shots.