# Crystal Maze totem pole puzzle

The UK game show "The Crystal Maze" features a puzzle based around a totem pole.

The contestant has four different coloured blocks which can be stacked up to make a totem pole. The blocks may be stacked in any order, but there is a single "correct" configuration, which is unknown to the contestant.

Once all four blocks are stacked, the contestant is told how many blocks are currently correctly positioned (but not WHICH blocks). The contestant is obliged to stack all four blocks before being told how many are correct.

The contestant can try as many times as they like, but they are working within a time limit.

Keep in mind, the blocks are heavy and awkward, so there is a time advantage to a strategy that minimises the amount of stacking and re-stacking of the tower. For example, it's faster to swap the top two blocks than it is to exchange the top and bottom blocks.

What's the optimal strategy for the contestant to solve this puzzle as fast as possible?

EDIT - For the sake of argument, let us say that it takes 1 second to remove a block from the top of the stack (however high the stack currently is), and 1 second to put a block on top of the stack.

So, building the complete stack from scratch takes 4 seconds. Swapping the top 2 blocks takes 4 seconds too:

1s to remove top block
1s to remove second block
1s to put the old top block back on in second place
1s to put the former second block on the top

Swapping the top and the bottom blocks would take 8 seconds:

4s to completely disassemble the stack
4s to rebuild the whole thing

There is only one special spot where you can build the stack - you can't optimise by taking the top block off and putting it down somewhere else to start a new stack.

First of all, I will explain this by using numbers, instead of colors. We already know that there are 24 possible way to put those colors in order:

# The outcome is 0

Among these, your first guess will not matter in the worst case scenario but I will take 1234 as the first guess so it will take $4$ seconds and I will get $9$ possibilities out of $24$ when the outcome response from the puzzle master is $0$ (which is also the worst outcome) as:

So to try any of these possibilities you need to spend $8$ seconds, This is something that we don't want to. So what if we try only swapping 1 and 2, which will take $4$ seconds:

So If we get $2$, we know the answer, but probably it will not be the case, The response will most probably be $1$ or $0$. Still we got rid of something! There is only 4 possibilities left (if it is $0$ or $1$, it is still $4$ possibilities). So we have to take at least $3$ blocks now which will take 6 seconds and let's see what options do we have:

$3124, 1324, 3214, 2314$

The good part of this is that after spending 6 seconds for these, the next could be $4$ seconds. Though we need to try all possibilities:

Here is our table by trying 3214 and then 1324 which will take $6+4$ seconds in total. If we check the table above, you will notice that whatever the outcome ($1$ or $0$), you will able to find the actual result! For example, let's say our outcome from previous try was $0$, which will drop the numbers to $3412,3421,4312,4321$. Then we tried $3214$ and got $1$ which is the worst case scenario, then after trying $1324$ we will get $0$ or $2$ and we would have found our colored blocks, one last try will take $8$ seconds more!

In total

In the worst case, the maximum time to find the order of colored cubes will take $T=4+4+6+4+8=26$ seconds with only 3 tries actually!

# The outcome is 1

Let's see what happens using the same numbers:

So the result does not change, in the worst case, the time and try requirement is the same, but if you are lucky, you can find the answer faster.

• It sure sounds like you have figured this out, but I will need a bit of time (and perhaps a pencil and paper!) to follow this through properly! Oct 2 '17 at 15:46
• One query - when you say "Here is our table by trying 3214 and then 1324 which will take 6+4 seconds in total." - are you sure? I think that going from 3214 to 1324 would take 6 seconds, not 4 seconds. Oct 2 '17 at 18:08
• aa my mistake, gonna fix it, it would be 2314... though it does not change the result :)
– Oray
Oct 2 '17 at 18:20
• @TenMinJoe fixed it. recheck it please.
– Oray
Oct 2 '17 at 18:56
• It looks like that one line that I pointed out hasn't actually changed, but I can see what you mean. Thanks for your hard work! Oct 3 '17 at 7:56

I have examined the puzzle and simple was to solve the problem is to look for combinations with 0 matches. This sounds counter-intuitive but if you keep swapping and getting 1 or 2 right (it is impossible to get 3 right) you are not sure if the correct totems are ones you changed or left the same. Converting colours to numbers I would start by checking. 1234 2341 3412 4123 I would check for zero matches each time and work on eliminating the ones that were wrong.

Thinking outside the box (I don't know if they would allow this I would try putting 1 totem at a time 1 2 3 4

Assume 4 is a match then

41 42 43 Assume 3 is a match

4312 4321 match

This could be done in 9 combinations maximum.