Magicians have long relied on sleight of hand and deception to thrill their audiences but they may now have another tool in their box of tricks – a computer.

Scientists have for the first time “taught” a computer to create magic tricks, using artificial intelligence (AI). They gave a computer program the outline of how a magic jigsaw puzzle and a mind-reading card trick work, and fed into it the results of experiments into how humans understand magic tricks.

The program created completely new variations of those tricks using complex mathematical techniques and algorithms, but which can still be performed by a magician.

The work could make tricks easier for budding magicians, but researchers also believe their work could benefit future medical science.

One trick involves assembling a jigsaw to show a series of shapes, then taking apart and putting it back together again so that certain shapes disappear, caused by a clever principle of geometry. The trick relies on several factors coming into play simultaneously, such as the size of the puzzle, the number of pieces involved, the number of shapes that appear and disappear and the ways that the puzzle can be arranged.

A second ‘mind-reading’ trick involves identifying a card that has been selected from a deck using a few seemingly innocuous pieces of information from the audience and using a mobile phone application to reveal the card on the phone’s screen.

The computer program was used to arrange the decks in such a way that a specific card could be identified with the least amount of information possible.

It identified arrangements for the deck that, on average, required one less question to be asked before the card was identified than using traditional methods, with the app avoiding the magician having to remember the order of the cards.

The research is published in the journal Frontiers in Psychology. The card trick is available as an app called Phoney, from the Google Play Store.

Sign up to our free newsletters

Get the best updates straight to your inbox:
Please select at least one mailing list.

You can unsubscribe at any time by clicking the link in the footer of our emails. We use Mailchimp as our marketing platform. By subscribing, you acknowledge that your information will be transferred to Mailchimp for processing.