The small robots can rectify mistakes made during the demonstration, avoiding a complete catastrophe.
Scientists at Harvard School of Engineering and Applied Sciences demonstrated a flashmob of 1,024 simple robots, collectively known as Kilobots to arrange themselves into complex shapes.
The aim of the demonstration was to show how simple behaviour among simple machines can create complex behaviours, and the demonstration was done successfully with the robots that collectively made the letter K and arranged themselves as a starfish.
Once the initial set of instructions was delivered, the Kilobots did not require any micromanagement or intervention.
Only four robots made the original coordination system while the rest received a 2D image of the activity they had to mimic, and following the procedure, the robots arranged themselves.
Harvard school of engineering and applied sciences, Prof Radhika Nagpal, said: "The beauty of biological systems is that they are elegantly simple -- and yet, in large numbers, accomplish the seemingly impossible.
"At some level, you no longer even see the individuals; you just see the collective as an entity to itself. We can simulate the behavior of large swarms of robots, but a simulation can only go so far.
"The real-world dynamics -- the physical interactions and variability -- make a difference, and having the Kilobots to test the algorithm on real robots has helped us better understand how to recognize and prevent the failures that occur at these large scales."
This technology marks the beginning of the use of collective artificial intelligence, which can be used to create complex machines that will be capable of eventually creating the swarm.