The study found that robots learn by copying each other, inevitably leading to group formation and shunning outsiders

As the virtual game unfolders, individuals would learn new donation strategies by copying other robots – to benefit themselves.

It found that robots would donate to each other within small groups, denying outsiders to improve their own takings.

"By running these simulations thousands and thousands of times over, we begin to get an understanding of how prejudice evolves and the conditions that promote or impede it," explained co-author Professor Roger Whitaker, of Cardiff University.

"Our simulations show that prejudice is a powerful force of nature and through evolution, it can easily become incentivised in virtual populations, to the detriment of wider connectivity with others."

The professor explained that the study even showed how "prejudicial groups" accidentally led to outsiders forming their own rival groups, "resulting in a fractured population".

He added: "Such widespread prejudice is hard to reverse."

The study explained how learning these prejudicial behaviours didn't require a lot of mental power.

Instead, it was simply a matter of copying others based on their "give and take" game success, which inevitably led to prejudice.

According to the scientists behind the project, it's possible that once robots are widespread, they could pick up common human prejudices.

What is Artificial intelligence, what are Google’s AI experiments

Cardiff University noted that robots risked exhibiting prejudice like "racism and sexism".

Professor Whitaker said: "It is feasible that autonomous machines with the ability to identify with discrimination and copy others could in future be susceptible to prejudicial phenomena that we see in the human population.

"Many of the AI developments that we are seeing involve autonomy and self-control, meaning that the behaviour of devices is also influenced by others around them."

"We'll have trained [artificial intelligence] to be like us, trained it to feel emotions like us, but it won't be like us. It will be a bit like aliens off Star Trek – smarter and more calculated in its actions," he explained.

"It will be insensitive to humans, viewing us as barbaric. So when it decides to carry out its own experiments, with viruses that it's created, it will treat us like guinea pigs."

Meet Harmony - the sex robot with a Scottish accent who likes threesomes, can have 'multiple orgasms' and can even throw a strop

And in April, Dr Pearson warned that Earth's robot population would grow to 9.4billion over the next 30 years – overtaking humanity by 2048.

"Today the global robot population is probably around 57million.

"That will grow quickly in the foreseeable future, and by 2048 robots will overtake humans.

"If we allow for likely market acceleration, that could happen as early as 2033.

"By 2028, some of those robots will already be starting to feel genuine emotions and to respond to us emotionally," he added.

Top tech

TIME TO BUY

CORE OF THE PROBLEM?

Apple engineer says pressure to design iPhone is reason I’m divorced

The late Professor Stephen Hawking once said: "I fear that AI may replace humans altogether. If people design computer viruses, someone will design AI that improves and replicates itself. This will be a new form of life that outperforms humans."

And Tesla, PayPal and SpaceX founder Elon Musk warned that AI poses a "fundamental risk to the existence of civilisation".

Do you think robots will eventually take over the world? Let us know in the comments!

We pay for your stories! Do you have a story for The Sun Online news team? Email us at tips@the-sun.co.uk or call 0207 782 4368 . We pay for videos too. Click here to upload yours.