Simple robots with no central controller that collectively sort, assemble, and explore.
No robot in a swarm knows the plan. Each has a short sensor range, a small set of reactive rules, and no memory of the global state.
Forty robots running "move toward visible neighbors, avoid collisions" aggregate into a tight cluster. Pick-up-and-drop rules sort mixed tokens into clean piles. Neighbor-count rules form circles and hexagons. The collective behavior is not coded anywhere; it emerges from the interactions.
Each robot steers toward the average position of its visible neighbors while keeping a minimum separation. With no neighbors, it wanders. Large sensor range means fast direct aggregation; short range means slow chain-like clumping.
Figure 1. Aggregation. Each robot moves toward the centroid of its visible neighbors while maintaining a collision buffer. Gray rings show the sensor radius of a few sample robots. Larger sensor range produces faster but less interesting convergence.
Scatter red and blue tokens across a field. A robot that walks over a token picks it up if same-color neighbors are sparse and drops it where they are dense. That is the whole algorithm. Mixed clusters resolve into sorted piles.
Figure 2. Collective sorting. Robots (gray dots) wander the field picking up isolated tokens and dropping them near same-colored groups. A robot carrying a token shows a colored ring. Adjust token density and watch sorting emerge at different rates.
Each robot knows the target as a distance function — how far any position is from the shape's boundary. It samples the local gradient and nudges toward the boundary.
Figure 3. Shape formation. Each robot evaluates a distance-to-shape function and follows its gradient toward the target boundary. Robots also repel each other at close range to distribute evenly. The faint outline shows the target shape.
Click to destroy robots; the remaining swarm closes the gap and reforms the shape. Add new robots and they absorb into the formation. A centralized system would have to detect failures and reassign roles. The swarm just keeps running its local rules.
Click on canvas to destroy robots near the cursor. Watch the swarm heal.
Figure 4. Resilience. The same shape-formation algorithm from Section 3, but now you can destroy and add robots. The swarm self-heals because no robot depends on any other specific robot. Remove half of them and the remainder still converges.
Harvard's Kilobot project demonstrated 1,000 simple robots self-assembling into arbitrary shapes using only short-range infrared. Each robot costs about $14 and has less processing power than a calculator.