Scientists have created a swarm of over 1,000 coin-sized robots that can assemble themselves into two-dimensional (2D) shapes by communicating with their neighbours.
"The self-organisation techniques used by the tiny machines - called kilobots - could aid the development of 'smart' robots that reconfigure themselves," researchers said.
"This shape-shifting robot flock is analogous to ants that build bridges out of their own bodies, demonstrating modular behaviour that allows them to adapt quickly to their surroundings," explained Michael Rubenstein, a computer scientist at Harvard University, Massachusetts in US.
The robots are programmed with a simple set of rules and an image of the shape to be formed.
To begin with, the robots are arranged in a tightly packed, arbitrary shape on a flat surface.
The robots communicate using infrared light, but they are only able to transmit and receive information with the robots nearest to them - so they cannot "see" the whole collective.
However, the "seed" robots act as the point of origin for a coordinate system.
The information on their position propagates outward through the swarm like fire signals across the peaks of a mountain range.
This allows each bot to determine where it is and whether it is inside the shape programmed by researchers.
Such behaviour could be useful in creating programmable matter: tiny robots the size of sand grains that could rearrange themselves into tools of any shape, such as a wrench.
"These future robots would act like a three-dimensional printer, but instead of printing with plastic filament, you would be printing with robots that can move themselves," Rubenstein added.
The study appeared in the journal Science and reported in the journal Nature.