How Artificial Intelligence Is Improving Magic Tricks

How Artificial Intelligence Is Improving Magic Tricks

By Joshua Rapp Learn
SMITHSONIAN.COM 
Computer scientists have designed a trick that uses an algorithm to search the internet for the words most associated with images

Forget lightning speed calculations, technological superiority and machine-like precision. Thanks to the efforts of some researchers, artificial intelligence can now create magic.

“We’ve done a number of different tricks involving artificial intelligence,” says Peter McOwan, a computer science professor at Queen Mary University of London.

McOwan and his coauthor, Howard Williams, recently published a study in PLOS ONE on using search algorithms to scour the internet to find the hidden mental associations magicians can use to astound their spectators.

“A piece of software is like a magic trick in that it has something that seems amazing,” McOwan says.

McOwan says he first got into magic when his father bought him a trick he picked up at a shop while on a business trip. He got hooked, but the hobby kind of dropped away later when he went to university. As he got into computer science, he realized that some of the same algorithms you can use to develop mathematically based card tricks were used to develop software and applications.

“I combined my passion for magic tricks with my passion for computer science,” he says, adding that what started off as a childhood hobby ended up as a whole field of research in artificial intelligence.

“Magic as a hobby is a fantastic thing to get into. It gives you self-confidence, it gives you the ability to learn communication skills—it’s a really good hobby to have.”

While the term “artificial intelligence” is often misconstrued to mean a whole assortment of robot apocalypse scenarios, much of what’s considered AI today is really born from algorithms. But using numbers to create tricks isn’t anything new—in fact many magic tricks involve math.

Jason Davison, a mathematical magician based in London, uses a minor sleight of hand and a few calculations to pull tricks like getting a given card you’ve chosen at any point in a deck you tell him just by shuffling the cards.

Another trick involves using a much more complex understanding of patterns and a little deck fixing to ensure that any way the spectator shuffles a deck, the cards will appear to have an uncanny order in which every set of four cards pulled from the top represent each of the four suits.

“There are many others with algebra and formulaic self-working tricks,” Davison says.

He has even designed a simple computer program that appears to be able to guess the correct color of a given card in a deck fixed in the same way as the latter trick. He gets the spectator to shuffle the cards as above, then divides the deck into two piles. He asks the spectator to guess the color of the cards in one pile one by one before revealing them and enters the answers into the program.

The robot then predicts the other pile, and (un)naturally gets it all right. But what might seem like robot mind-reading is really just a programmatic sleight of hand. Davison knows which colors the cards will be in that pile because they will be the opposite of the spectator’s pile based on the way the deck is shuffled. So when the spectator gets one wrong, he inserts an extra space before the answer he types. This cues the program that the answer is wrong.

So rather than controlling something we can’t comprehend, the program is merely a slave to Davison’s own knowledge of the pack. “The computer ‘guesses’ the coloring of the other pile using this information I have fed to it,” he said in an email.

McOwan has taken algorithms to the next level, though.

His trick works like this. A custom deck will have cards with words, and another pile of cards will have images. Spectators will be asked to instantly choose word cards that associate most closely with an image. (The researchers invite you to download the cards and instructions.)

The real magic in this trick comes in determining how far off the wrong meanings can be without seeming fixed. You might have a picture of a hamburger, for example. But if you have five words—hungry, fish, cat, boat and tree—it will be obvious to anyone which card the spectator will associate with the photo.

If the words instead are hungry, tray, lettuce, bun, and ketchup, the ability to guess the right answer seems much more uncanny though.

McOwan says that in order to determine the precise difference, he used a complex algorithm that searches the internet to find the words most often associated with particular images. The algorithm specifically looks at the words that popular commercial brands use to accompany their products—so in a sense he’s harnessing all the work of decades of marketing research to figure out which word associations we are most likely to make with an image. So even though it seems like you have a choice, your unconscious decision is locked in fate.

“This is basically a new probe into looking at how people’s brains work,” McOwan says, adding that a magician could do this without a program but it would take a huge amount of trial and error before figuring out the most likely answers.

Other tricks he has created with the help of a computer include the design of a jigsaw puzzle that appears to lose simple lines if you put it together a different way. It’s based on a type of illusion in which an algorithm has calculated the amount of changes you can make to shapes without people noticing anything is amiss.

This would be incredibly difficult for a human to design, but a computer program makes it quite easy.

Davison says that other computer-based tricks are coming out with new technology. He talks about trick dice that cue the magician to the numbers they show by sending a signal to a mechanical ticker attached to the magician’s leg, or even trick websites or applications that somehow send messages to magicians.

“I would say that AI definitely has a strong place in magic in the future,” he says.

Brian Curry, a professional magician in the Washington, D.C. area, agrees. He says that some of the tricks that would have astounded audiences 15 years ago no longer pack the same punch because there are apps that do the same work. But new technology can also help magicians stay on top of the game.

“Technology and magic are always correlated,” he says.

McOwan says there are possible uses for artificial intelligence in other forms of magic beyond card tricks. He says that he and other researchers did some initial work on mathematical models for optimizing sleight of hand tricks. It could also be used for designing optical illusions on the stage—tricks such as making a cabinet appear smaller than it actually is and giving someone space to hide in it.

McOwan says that right now, artificial intelligence can only help magicians gain the raw material for a trick. The real magic comes in conjuring up a spectacle, though—the performance art and pulling of a convincing rendition. To that end, while he might reveal to computer science students the magic tricks he creates personally, he considers some of the more clever mathematical tricks employed by professional magicians off limits.

“They are just so so clever,” he says, adding that he would perform them but never reveal them. “I would never give away the real secrets of the trade,” he says.

These computer-based tricks may become more and more popular, Davison says.

“But at the same time, nothing is more glorious than making someone childishly believe in magic again with nothing more than a simple coin.”

SMITHSONIAN.COM 
Finally, A Shoe That Grows With a Kid

Finally, A Shoe That Grows With a Kid

SMITHSONIAN.COM 

The Idaho-based nonprofit Because International makes shoes that can grow up to five sizes and last at least five years

Kenton Lee looked down and saw the feet of a little girl standing beside him. The front of her shoes had been completely cut open, and her toes curled over the edges. Other children at the orphanage where he was volunteering in Nairobi, Kenya, had also outgrown their shoes and were similarly making do. According to a supervisor, the children had received a shipment of shoe donations awhile back, but hadn’t gotten any others since.

“Wouldn’t it be nice to have a pair of shoes that could adjust and expand?” Lee recalls thinking. “That would make a lot of sense for these kids.”

The recent college graduate returned home to Nampa, Idaho in 2008, and a year later, founded the nonprofit Because International, with the aim of “making things better by making better things.” Lee quickly got to work designing a pair of shoes that could grow with a child.

Throughout the process, he kept asking, “How can we create a pair of shoes that can grow as much as possible and last as long as possible, while costing as little as possible?”

Shoes that grows

In partnership with the Portland, Oregon shoe development company Proof of Concept, Lee and his team launched their first official batch of 3,000 shoes in the fall of 2014, with other versions to follow. Currently, each pair looks like a sturdy sandal and is made of leather straps and compressed rubber soles, a material similar to the kind used in tires. They come in two sizes—small, for kindergarteners to fourth graders, and large, for fifth through ninth graders—adjusting in three places. Straps on the heel and toe control the length of the shoe, while two on either side allow for different widths. The shoes can expand up to five sizes and last for at least five years.

The cost of the shoe, anywhere from $12 to $30, depends on how many pairs an organization or individual purchases at one time. Supporters can buy shoes at $10 a pair that go into a “duffel bag” belonging to different charitable groups that will ship once it contains 50 donated pairs. Because International focuses primarily on producing the shoes and relies on donations and help from nonprofits to distribute the footwear to places in need around the world.

Shoes that grows

Lee, now a pastor, graduated from Northwest Nazarene University in 2007 with a degree in business administration and religion. “I didn’t know a thing about shoes,” he says. So, he and his board went to the experts. “We started by contacting all the big companies—Nike, Adidas, Crocs, Toms—to see if they’d like to take the idea and make it happen,” he says. “Nobody was interested.”

After getting turned down, Lee decided he had to create the shoes himself. “I bought 20 pairs of Crocs and cut them up and was piecing them together to figure out a design that would work,” he says. While experimenting, the Because International team connected with Proof of Concept, run by Gary Pitman, a veteran in footwear design and manufacturing who had worked at Nike and Adidas.

Together, Because International and Proof of Concept whittled down 70 potential ideas to two feasible models. In the summer of 2012, Lee and his wife, Nikki, took 100 prototypes to four different schools in Kenya and had kids wear and test them for about a year. The team took the kids’ feedback on fit and comfort into account and produced their 2014 batch, which sold out. Because International is now eagerly awaiting a shipment of 5,000 more pairs.

The rugged sandals are best suited for warm environments since part of the foot is still exposed, and Because International has seen high demand in countries such as Kenya, Uganda, Rwanda and Haiti. The shoes allow kids to experience daily life without worrying about exposing their feet to soil-transmitted diseases and rough terrain.

My biggest motivation is that I want kids to be in the best possible position to succeed and to keep them a little bit happier and healthier,” says Lee, who feels his product could impact kids’ walks to school and time spent playing outside. “To see them lose some of these chances because of something as simple as a pair of shoes really breaks my heart.”

To scale up, Lee ultimately wants to work with businesses in the regions where the shoes are being used most to develop local bases for manufacturing, distribution and sales. “One day, we could have a factory in Haiti, a factory in Kenya, a factory in Nicaragua,” he says. He also hopes to continue partnering with nonprofits that can get shoes to kids who need them.

Parents of growing kids worldwide can surely relate to the product, and many have expressed an interest in purchasing the shoes for their own children. In the next few months, Lee and his team are working on a commercial version. There may be a means for people to purchase the product and give back, perhaps with a one-for-one, buy-a-pair-give-a-pair model like Toms.

By Li Zhou is the digital editorial intern for
Smithsonian.com. She has previously written
for The Boston Globe, PolicyMic and Interview Magazine.