Drones have evidently been programed with a new skill: the ability to dart and dive away from a sword.

Researchers at Stanford University’s Autonomous Systems Laboratory have released a video that shows an autonomous drone doing everything from gently adjusting its position to dramatically swooping away as a masked swordsman antagonizes it with a foil.

The quadrocopter drone then returns to a stable hovering position after dodging the blade, even after bouncing off the floor.

Related: 'The Next Rembrandt' 3D printed painting unveiled

The Autonomous Systems Laboratory refers to this kind of technology as “real-time kinodynamic planning,” and says that it was made possible by an algorithmic framework that the researchers developed.

And while it seems unlikely that a drone will have to face off against a medieval weapon like a sword anytime soon, this type of skill— the ability for a robot to respond in real-time to obstacles in its way—is necessary to help drones and other robotic systems execute real-world tasks, like delivering packages in crowded areas, the lab said.

Related: Inside the first-ever Special Ops Urban Assault competition  

For example, with its “Prime Air” service, Amazon hopes deliver packages weighing as much as 5 pounds to customers in less than half an hour, and says the machines will use a technology called “sense and avoid.”