It only takes one farmer and a sheepdog to round up a flock of sheep and now a study has revealed how they do it.
Scientists put trackers on a flock of sheep and watched how they moved around in response to the sheepdog.
The findings showed revealed two main tricks used by the dogs.
First the sheepdog learns how to make the sheep come together in a group. Then when the sheep are together, the dog pushes them forwards.
Dr Andrew King of Swansea University was involved in the study and said: "One of the things that sheep are really good at is responding to a threat by working with their neighbours. It's the selfish herd theory: put something between the threat and you. Individuals try to minimise the chance of anything happening to them, so they move towards the centre of a group."
The findings could be used to develop a 'shepherd robot' but some farmers are not convinced it would be as good as a dog.
The study's results could also be used to develop robots for controlling crowds or cleaning up an oil spill.