How to escape a maze – according to maths

January 26, 2017 by Ruth Dalton And Nick Dalton, The Conversation
I’m sure there’s an equation for this… Credit: Shutterstock

Mazes are in vogue at the moment, from NBO's Westworld, to the return of the British cult TV series, The Crystal Maze. But mazes have been around for millennia and one of the most famous mazes, the Labyrinth home of the Minotaur, plays a starring role in Greek mythology.

Which begs the question: what is the difference between a maze and a labyrinth? Although considered synonymous by some, it is generally accepted that a labyrinth contains only one path, often spiralling around and folding back on itself, in ever-decreasing loops, whereas a maze contains branching paths, presenting the explorer with choices and the potential for getting very, very lost.

While designing a maze can be a rewarding human task, computer scientists and mathematicians have a love of maze-generating algorithms. The algorithms tend to fall into two principal types: ones which start with a single, bounded space and then sub-divide it with walls (and doors) to produce ever smaller sub-spaces; and others which start with with a world full of disconnected rooms and then demolish walls to create paths/routes between them.

The great escape

There are techniques for escaping from mazes, but first you need to be sure what kind of maze it is. Most methods work for "simple" mazes, that is, ones with no sneaky short-cuts via bridges or "passage loops" – circular paths that lead back to where they started.

Trémaux’s algorithm

So, assuming it is a simple maze, the method that many people know is "wall-following". Essentially, you place one hand on a wall of the maze (it doesn't matter which hand as long as you are consistent) and then keep walking, maintaining contact between your hand and the wall. Eventually, you will get out. This is because if you imagine picking up the wall of a maze and stretching its perimeter to remove any corners, you will eventually form something circle-like, part of which must form part of the maze's outer boundary. This method of escape may not work, however, if the start or finish locations are in the maze's centre.

But some mazes are deliberately designed to frustrate, such as the Escot Gardens' beech hedge maze in Devon, which contains no fewer than five bridges, and so far from "simple".

Another method of maze escape, known as Trémaux's algorithm, works in all cases.

Imagine that, like Hansel and Gretel in the fairy story, you are able to leave a trail of "breadcrumbs" behind you as you navigate your way through the maze and then remember these rules: if you arrive at a junction you have not previously encountered (there will be no crumbs already on the trail ahead), then randomly select a way to go. If that leads you to a junction where one path is new to you but the other is not, then select the unexplored path. And if choosing between a once or twice-used path, choose the path used once, then leave a new, second trail behind you. The cardinal rule is never, ever select a path already containing two trails. This method is guaranteed, eventually, to get you out of any maze.

Everyday mazes

So how is any of this maze stuff useful? Well, from the perspective of architecture and urban design, we want to avoid accidentally creating mazes. Mazes are fun, but are not necessarily something we want in our everyday lives – or in our way when we just want to get to work.

In the 1980s, the architectural theorist, Bill Hillier, observed that many of the most socially problematic housing estates were those that appeared to be somewhat "maze-like" in their layout. This begged the theoretical question: how do we actually measure the "maze-iness" of a place?

To answer this, Hillier developed the measure of "intelligibility", which is the relationship between what is immediately visible from a single location in a maze/housing estate/neighbourhood and how accessible that same place is from other locations in the area. The measure ranges from 0 to 1: environments that score highly (greater than 0.5) tend to be quite intelligible, easy to understand and navigate, and frequently desirable – for example Barnsbury, in London.

Conversely, places with a low intelligibility score tend to be confusing, hard to navigate and, ultimately, maze-like – London's Barbican Estate, although architecturally lauded, is so confusing that visitors need to follow the yellow lines in order to find their way around.

It was this measure of intelligibility that we used to design the game levels in the recent SeaHeroQuest game, a game designed to measure people's navigational skills in order to further dementia research.

We "reverse-engineered" intelligibility in order to produce game levels that were more, or less, maze-like, to ensure a range of challenges for the players. Therefore, the mathematics of design is just as applicable in modern, dementia-battling apps as it was in distant Greek mythology.

Explore further: Chimpanzees show ability to plan route in computer mazes

Related Stories

Chimpanzees show ability to plan route in computer mazes

April 13, 2015

Chimpanzees are capable of some degree of planning for the future, in a manner similar to human children, while some species of monkeys struggle with this task, according to researchers at Georgia State University, Wofford ...

A GPS from the chemistry set

October 27, 2014

Swiss scientists teamed up with colleagues from Hungary, Japan and Scotland to develop a chemical 'processor' that reliably shows the fastest way through a City maze. As the method is basically faster than a satnav system, ...

Oil droplets can navigate complex maze (w/ Video)

February 18, 2010

Call them oil droplets with a brain or even "chemo-rats." Scientists in Illinois have developed a way to make simple oil droplets "smart" enough to navigate through a complex maze almost like a trained lab rat. The finding ...

How the brain makes sense of spaces, large and small

August 26, 2014

When an animal encounters a new environment, the neurons in its brain that are responsible for mapping out the space are ready for anything. So says a new study in which scientists at the Howard Hughes Medical Institute's ...

The supremely intelligent rat-cyborg

March 7, 2016

When Deep Blue battled the reigning human chess champion the world held its breath. Who was smarter … man or machine? A human victory would confirm the superiority of human intelligence, while a victory for Deep Blue would ...

Recommended for you

New paper answers causation conundrum

November 17, 2017

In a new paper published in a special issue of the Philosophical Transactions of the Royal Society A, SFI Professor Jessica Flack offers a practical answer to one of the most significant, and most confused questions in evolutionary ...

Chance discovery of forgotten 1960s 'preprint' experiment

November 16, 2017

For years, scientists have complained that it can take months or even years for a scientific discovery to be published, because of the slowness of peer review. To cut through this problem, researchers in physics and mathematics ...

2 comments

Adjust slider to filter visible comments by rank

Display comments: newest first

Cardo
not rated yet Jan 27, 2017
"Which begs the question: what is the difference between a maze and a labyrinth?"

FYI, that is not how one "begs" the question. "To beg a question means to assume the conclusion of an argument."
krundoloss
not rated yet Jan 30, 2017
Whenever I play video games, which have mazes, I always turn left. It has worked out pretty good. This assumes you can keep track if you have been somewhere before. Being "in a maze" is much different than solving a maze puzzle.

Please sign in to add a comment. Registration is free, and takes less than a minute. Read more

Click here to reset your password.
Sign in to get notified via email when new comments are made.