AI Helps Magicians Perform Mind-Reading Tricks

Computer Aided Magic Tricks
Illustration: iStockphoto
Computer algorithms can help magicians create magic tricks that exploit human psychology

You are presented with two decks, one with images and the other with words. The magician shuffles and distributes the decks into piles of four cards. You get to choose two piles, one from the word deck and one from the image deck, to make a hand of eight cards. Then you’re invited to pick a word card and and an image card from your hand. Once you’ve selected a pair, you watch the magician reveal a previously written prediction about the cards you’ve chosen. The prediction is correct!

That kind of “mind-reading” magic trick could benefit from new AI computer algorithms. These algorithms are designed to exploit human psychology and help magicians choose the best card combinations.

This “association” magic trick relies upon making a spectator believe that the magician has managed to predict his or her free choice from a random combination of shuffled cards. In reality, the magician has preselected two decks of cards that together contain a category of card pairs that trigger a particularly powerful mental association for most people. To help pull off this mind-reading illusion, computer scientists created a computer algorithm that can automatically help find compelling word and image combinations.

“First and foremost it’s an entertaining magic trick we have built, but it does potentially allow insight into the processes that humans use to decide associations,” says Peter McOwan, a professor of computer science at Queen Mary University London in the UK. “There are a range of mentalism tricks that use associations to accomplish their effects and similar computational frameworks could be applied” across that range, he said.

McOwan began practicing magic as a hobby in his teens. He has since used magic tricks to teach computer algorithms and has written free e-books on the intersection between the two subjects. In recent years, McOwan has teamed up with Howard Williams, another computer scientist at Queen Mary University London, to develop computer algorithms that can help create new magic tricks. Their latest study on the association magic trick was published in the 9 Aug 2017 issue of the journal PLOS One.

The association magic trick takes advantage of how the human subconscious tends to form strong mental associations between certain concepts. For example, people may quickly make food associations between images of burgers or fruit and related words such as “bites,” “treats,” “snack” and “feast.” The human subconscious can quickly recognize and process such associations in a way that appears almost automatic to the conscious mind.

Another key part of the trick involves an appreciation of two psychological systems that underlay our decision making, as described by Daniel Kahneman, a psychologist and Nobel Prize-winner. System 1 covers the swift and seemingly automatic mental processing. System 2 refers to the more active, conscious thinking involved in planning, puzzle solving or calculations.

The magician wants the spectator participating in the magic show to use the first system and make the automatic association because it makes his or her choice predictable—especially when the decks of cards are organized and shuffled in a way that ensures a matched pair of cards that belong to a certain category will always be among the choices. So the magician adds time pressure by asking the spectator to make a quick decision. That pressure typically ensures the spectator makes the predictable choice rather than making a more idiosyncratic pairing based on the more conscious thought processes of the second system.

To collect relevant data in making the magic trick, the Queen Mary University London researchers performed an online psychology experiment by showing human participants various selections of 10 trademarks from a pool of 100 of the most famous trademarks. The researchers then asked participants to write down any words about how the trademarks made them feel, along with any other associations they had with each mark.

But the researchers also developed an AI to help them find strong associations for the magic trick. First, their computer algorithm ran Internet searches on popular trademarks and plucked words from the webpages linked by the top ten search results for each trademark. Second, it used a previously developed search algorithm, called BM25, to organize and rank the collected data according to certain association categories (such as food-related words). Additional AI techniques called word2vec and Wordnet helped by providing similarity scores for certain word pairings.

The AI by itself was not necessarily able to find the strongest or most useful associations for the magic trick without human help. But such automated data gathering and organization could prove a handy time-saving tool for complementing data collected from the more time-consuming experimental surveys, according to Williams at Queen Mary University London. He described the tradeoff as follows:

Automated data gathering is useful as it is quick and can gather large sets of data. Experiments take longer to organize, perform, process data, etc., but provide more specific and targeted data. [It’s] essentially a tradeoff between quality and quantity. Though quantity provides broadness, and is useful in its own right.

That process led Williams and McOwan to create image and word card decks that contained the food category as the likeliest choice. They tested out their association magic trick on 143 individuals during the Big Bang 2013 science fair in Birmingham, UK, where it succeeded in all but 15 cases. Those more unusual word and image pairings chosen in the unsuccessful cases could potentially be excluded by the computer algorithm or by hand in the future.

“Even though there is a fairly clear pathway we have created in the trick for them to follow in the performances, some people just had left field associations probably influenced by their life experiences,” McOwan says. “It’s an area worth looking at more.”

Magicians could eventually make use of popular AI techniques such as machine learning and deep learning that can automatically find and learn from patterns in data. McOwan speculated that such techniques could prove useful in “cold reading,” which is when a magician uses psychological tricks and a data-driven understanding of population trends to pretend to divine personal details about a stranger.

The researchers have already commercialized magic tricks that were created with the help of computer algorithms. In 2014, they used a computer algorithm to help create a “magic jigsaw puzzle” that makes certain shapes seem to disappear upon reassembly based on certain geometric principles. That jigsaw puzzle “sold out two production runs in a well known London magic shop,” McOwan says.

The idea of computer algorithms helping create magic tricks may lack the emotional drama of Christopher Nolan’s film The Prestige, where rival magicians vie to perfect their magic illusions. But even some of the fictional wizards in the magical world of Harry Potter might appreciate muggle AI technology that can help magicians seem to perform mind reading without wands and spells.

“Of course a trick is only as good as the performer and our work is simply giving new tools to create new methods to perform with,” McOwan says. “The real magic still lies with the magician.”


Tech Talk

IEEE Spectrum’s general technology blog, featuring news, analysis, and opinions about engineering, consumer electronics, and technology and society, from the editorial staff and freelance contributors.

Newsletter Sign Up

Sign up for the Tech Alert newsletter and receive ground-breaking technology and science news from IEEE Spectrum every Thursday.