Still only a lab prototype, the wriggling Rambo is designed to be dropped out of helicopters and creep around battlefields, using optical and audio sensors to build up a picture of enemy activity.

  

Because it hugs the ground, the snake should be less visible and more versatile than conventional reconnaissance robots – which tend to get shot down or get wheels blown off.

  

But spy snake is made up of snap-together vertebrae and moved by muscles made of shape-memory metal - an alloy of nickel and titanium that shrinks when an electrical current is passed through it.

  

By switching the current on and off, the wires spring back and forward, making the electric serpent wriggle.

  

Amazing software

 

But the brainiest part of the device, revealed in next Saturday's issue of New Scientist, is the software - which takes a "survival of the fittest" approach to produce a system that continually evolves to improve itself.

  

The algorithmic program starts off with a population of 20 "digital chromosomes," each corresponding to a binary digit that either activates or deactivates a muscle wire.

  

These chromosomes form the raw mathematical basis for the snake's movement.

  

Some chromosomes may result in the robot moving, and others will not. The program tries them all out and awards them a fitness rating, depending on how far it makes the snake move.

  

The two best chromosomes are then saved, the remainder are mixed up or randomly mutated like genes in nature, and the process is repeated.

  

Evolving snakes

 

After a number of generations, the amount of improvement gradually tapers off, signifying that the chromosomes have reached a plateau of the best possible arrangement.

  

Computer scientists Peter Bentley and Siavash Harun Mahdavi, at University College London, designed and tested the program by disabling some of the robot's segments to see if it could adapt to injury.

  

Initially, the snake was immobilised but eventually its "brain" worked out how to move again, "albeit more awkwardly and with an ungainly, dragging gait -- but it was still good enough to get the robot to its destination."

  

The research has been funded by the British aerospace company, BAE Systems.