Enter the maze

Manufacturing magic

by Howard Williams, Queen Mary University of London

A jigsaw question mark: Image by Bikki from Pixabay 3612855

Can computers lend a creative hand to the production of new magic tricks? That's a question we have been wrestling with for the past few years at Queen Mary University of London. The idea that computers can help with creative endeavours like music and drawing is nothing new - turn the radio on and the song you are listening to will have been produced with the help of a computer somewhere along the way, whether it's a synthesiser sound, or the editing of the arrangement and some compositions are created purely inside software. Researchers have also been toiling away for years at trying to build computer systems that actually write the music too! Some of the compositions produced in this way are surprisingly good! Partly inspired by this work, we decided to explore whether computers could create magic.

The project to build creative software to help with producing new magic tricks started with the production of a magical jigsaw that could be re-arranged in certain ways to make objects on its surface disappear. Pretty cool, but what part did the computer play?

A jigsaw is made up of different pieces, each with four sides - the number of different ways all these pieces can be put together is very large; for a human to sit down and try out all the different configurations would take many hours (perhaps thousands, if not millions!). Whizzing through lots of different combinations is something a computer is very good at. When there are simply too many different combinations for even a computer to try out exhaustively, software designers have to take a different approach though.

A Genetic Algorithm is a computer program that mimics the biological process of natural selection (see 'Only the fittest slogans survive'). We used Genetic Algorithms to intelligently search through all the interesting combinations that the jigsaw might be made up from. A population of jigsaws is created, and is then 'evolved' via a process that evaluates how good each combination is in each generation, gradually weeding out the combinations that wouldn't make good jigsaws - at the end of the process you are hopefully left with a winner; a jigsaw that matches all the criteria that you are hoping for. In this particular case, we hoped to find a jigsaw that could be built in two different ways, but each with a different number of the same object in the picture, so that you could appear to make an object disappear and reappear again as you made and remade it. The idea is based on a very old trick by Sam Lloyd, but our aim was to create a new version that a human couldn't, realistically, have come up with, without a lot of free time on their hands!

To understand what role the computer played, we need to explore the Genetic Algorithm mechanism it used to find the best combinations. How did the computer know which combinations were good or bad? This is something creative humans are great at - generating ideas, and discarding the ones they don't like in favour of ones they do. This creative process gradually leads to new works of art, be they music, painting, or magic tricks. We tackled this problem by first running some experiments with real people to find out what kind of things would make the jigsaw seem more 'magical' to a spectator. We also did experiments to find out what would influence a magician performing the trick. This information was then fed into the algorithm that searched for good jigsaw combinations, giving the computer a mechanism for evaluating the jigsaws similar to the ones a human might use when trying to design a similar trick.

We went on to use these computational techniques to create other new tricks, including a card trick, a mind reading trick on a mobile phone, and a trick that relies on images and words to predict a spectator's thought processes. You can find out more at qmagicworld.wordpress.com

There is a lot of debate about whether this kind of 'Artificial Intelligence' software, is really creative in the way humans are, or in fact creative in any way at all. After all, how would the computer know what to look out for if the researchers hadn't configured the algorithms in specific ways? Does a computer even understand the outputs that it creates? The fact is that these systems do output novelties though - new music, new magic tricks - and sometimes in surprising and pleasing ways, previously not thought of.

Are they creative (and even intelligent)? Or are they just automatons bound by the imaginations of their creators? What do you think?