Mazes can be mind-boggling, leaving kids and adults alike scratching their heads in their struggle to find the way out.
Some can be quite small and fairly simple, others are purposely designed to frustrate and leave you questioning your every move.
Currently, the ‘Longleat Maze’ in Wiltshire is the largest maze in the UK, and was once the biggest maze in the world.
With almost two miles of path to choose from, visitors are bound to find themselves frazzled when trying to escape.
Luckily for maths geeks, there’s an algorithm that may be able to help you reach the end.
How do you use maths to escape a maze?
As reported by BBC Future, you firstly need to be sure what kind of maze you’re planning on escaping.
Most mathematical methods work for ‘simple' mazes, with no short-cuts or 'passage loops', but complicated ones may be tricky.
Believe it or not, sometimes, your hand is the answer. If you place one hand on a wall of the maze, then keep walking, you will eventually get out.
This is all to do with the perimeter, if you imagine picking up the wall of a maze and stretching it to remove corners, it will become a circle.
But what about those complicated mazes that are designed to make us want to tear our hair out?
The previously mentioned ‘Longleat Maze’ may take a little more than placing your hand on the wall, it’s going to need more maths.
Take Escot Gardens' beech hedge maze in Devon for example, it has various bridges designed to confuse explores.
This is where the ‘Trémaux’s algorithm’ comes into play.
Also known as the ‘maze-solving algorithm’ invented by Charles Pierre Trémaux, this trick is guaranteed to work on all mazes.
It might not find you the shortest route, but it’ll definitely get you out, you may need a pen for it though.
It’s a bit like Hansel and Gretel without the breadcrumbs, which is probably a more simple way of putting it.
The basic rules are, if you arrive at a part of the maze that isn’t marked, randomly select a way to go.
If that leads you to a junction where there’s a new path to you but also an old path, select the unexplored path.
For those who find themselves stuck between the choice of a once-used path or twice-used path, use the once-used path, and leave a second trail behind you.
The algorithm states to never, ever select a path containing two trails though, as you may end up in a bit of a pickle.