Robots don’t feel pain, which is good, because what this six-legged robot does would be almost impossible with anything even resembling a human nervous system. Published today in Nature, “Robots that can adapt like animals,” looks at a robot that can relearn how to walk after losing multiple limbs. It’s a fascinating study into machine adaptation, and easy fuel for countless terrifying pulpy sci-fi plots.

Curiously, this adaptation is inspired by animals. While pain certainly inhibits immediate functioning, plenty of multi-limbed creatures figure out how to get by on their remaining limbs, whatever they may be. Inside these six-legged robots brains are maps of movement possibilities. With a limb disabled, the robot tries to walk according to its previous pattern. When that fails, it tries a couple other patterns until settling on one that enables it to go mostly straight. And then it tests one more just in case.

The algorithim works for six different injuries to the robotic walker, including the loss of two limbs, but it’s utility goes beyond just relearning how to walk. The same process can guide a ball-dropping robotic arm, even when a joint motor there fails to work. The whole process takes less than two minutes, and by trying out new patterns of movement, it enables the robots to skip past lengthy diagnostic processes, instead getting back on track faster.

Watch it below: