What could go wrong?

As programmed, each robot knows three things: how to follow the edge of a group; how to track its distance from where it had started; and how to maintain a sense of its relative position.

A single command, beamed to them all simultaneously via infrared, sets the process in motion.

In theory, there is no limit on the size, scale or complexity of a robot swarm. “It could automatically change shape to adapt to the task at hand,” Dr. Rubenstein said. “You could have them build other robots out of themselves.”