Magicians are not supposed to reveal their secrets. But what if that magician is a machine? Recent experiments at Queen Mary University of London show that it's not only possible to teach a computer program how magic tricks work, but that these systems are capable of designing new and superior versions that can be performed by humans.

Advertisement

For this particular AI-designed trick to work, the magician must arrange the cards in a pre-determined way. Then, based on a few seemingly unimportant and innocuous pieces of information provided by an audience member (such as the color of the card), the magician — with the help of an Android app — is able to reveal the identity of the card on a mobile phone screen.

Clearly, it's the specific arrangement of the cards that's providing the true "magic" here. This is not some sleight-of-hand trick, but rather one based on mathematical principles.

"Computer intelligence can process much larger amounts of information and run through all the possible outcomes in a way that is almost impossible for a person to do on their own," said project co-creator Howard Williams. "So while a member of the audience might have seen a variation on this trick before, the AI can now use psychological and mathematical principles to create lots of different versions and keep audiences guessing."

Advertisement

The computer, after being taught how mind-reading card tricks work (more formally known as combinatorial card tricks), is able to design deck orientations that allow a specific card to be identified with the least amount of information possible. Incredibly, the system identified arrangements for the deck that on average required one fewer question to be asked before the card was found than with the traditional method. The app, called Phoney, is simply a tool that helps the magician to avoid having to memorize the order of the cards.

"Using AI to create magic tricks is a great way to demonstrate the possibilities of computer intelligence and it also forms a part of our research in to the psychology of being a spectator," noted QMUL team member Peter McOwan. "For example, we suspected that audiences would be suspicious of the involvement of technology in the delivery of a trick but we've found out that isn't the case."

The researchers also had the system create a magic jigsaw puzzle. It involves assembling a jigsaw to show a series shapes, then taking it apart and reassembling it so that certain shapes have disappeared using a clever geometric principle. Something this complex is outside of human capacities, but it's ideal for an algorithm to process and to make decisions about which flexible factors are most important.

Advertisement

Read the entire study at Frontiers in Psychology: "Magic in the machine: a computational magician's assistant."