Using just a few preprogrammed rules, some traffic laws and a stack of foam bricks, the bots get busy building towers, pyramids and fortresslike walls, Harvard computer scientist Justin Werfel and colleagues report in the Feb. 14 Science.

One day, such robotic builders might be able to take on risky human jobs, such...