## Nov 27 Crystal Maze Maths

I went to the Crystal Maze experience in Manchester on a Stag/Hen Do with my university friends this weekend.

There were 8 of us and each challenge that you complete gains you one crystal. Each crystal gives your team 5 seconds of time in the crystal dome at the end where you try to collect as many golden tickets as you can. Some of the challenges get the team member attempting them to get locked in if they take too long or fail in some other way. I'm currently sporting a bruise on my arm from rushing out of a room with very little time left. The team can choose to buy their freedom at the cost of one crystal, which means they would be able to help gather tickets at the end, but overall the team would have less time.  On the way there we got thinking about the maths for when to trade in a crystal to free a locked in team member.

The thing we want to maximise is the number of people multiplied by the number of unspent crystals. Let's say you have L locked in people and C crystals, both of which are constants (and natural numbers). Let's say X is the number of people you let out where X is less than or equal to L, then the thing you are trying to maximise is Y=(8-L+X)(C-X). This is an optimisation problem where we should find the stationary point. Let's expand out first then differentiate and put it equal to 0. Y=8C-8X-LC+LX+CX-X^2 so dY/dX=-8+L+C-2X=0 and rearranging for X we get X=(L+C)/2-4.

As an example, if you have one person locked in, L=1 and 5 crystals, C=5, then we get X=6/2-4=-1 which is negative and it is saying that if it was an option it would be good to sacrifice one of your players for 1 extra crystal, so no deal. However, the more crystals you have and the fewer remaining number of members of the team, the more you should free. At 3 locked up and 9 crystals, X=12/2-4=2 so you should release two out of the three. I think in practice you would release all of your team mates in almost all circumstances, so that they don't miss out on the fun.