# Combination lock on a triangular rotating table

This puzzle is part of a serie.

## Puzzle

You are trapped in a dark room. Just your luck... Well, you were cursed with bad luck at birth, so literally everything that can go wrong will go wrong. That's why you grew up to be a fine logician and not a happy-go-lucky farmer hoping for a normal amount of rain or something like that.

Hum, anyway, the door is locked, but luckily the locking device is inside the room. It is quite a bizarre setup. There is a rotating table inlaid with 3 rotating dials. arranged in an equilateral triangle. The dials cycle between 0, 1 and 2, so there are only 33 = 27 possible combinations. Actually, you even know the code, it is 000... The problem is that you can't see (and can't feel) the numbers in this dark room. Moreover, if you are not near the table holding it in place, it rotates erratically, and you can't figure which dials you just modified.

Is there any hope to reach the magic code 000, for you, the unluckiest person imaginable?

## Rules clarification

There is no tricks or lateral thinking in this puzzle, you can only alternate between:

1. Modifying the code, with an increment XYZ: X for the first dial, Y for the second, Z for the third, and if a digit goes over 2 it cycles back to 0
2. Going to the door to test if it is the correct code ABC = 000, but meanwhile the code can rotate from ABC to BCA, CAB or ABC.

You have to find a surefire strategy; you can't rely on your luck.

• English is not my primary language so any help with the wording would be very appreciated! Especially the table setup is maybe unclear, I'm not sure about "inlaid" and "dials". Commented Sep 4 at 23:44
• Fun puzzle (and the writing is good enough)! +1 Commented Sep 5 at 6:22
• Very cool puzzle, I was even thinking on posting a similar one recently. I just so happened to write my master's thesis on a generalization of this puzzle type (dressed up as a 2-player game), so it's very nice to see that other people thought about these as well Commented Sep 5 at 8:45

We denote a change followed by a door check by its increments, and a string of such pairs as a list separated by dashes (e.g. 012-111-211).

Opening the door is possible, using a combination of three strategies:

Strategy 3 [S3]: 111-111-111 opens the door iff all three dials read the same number, and leaves the dials unchanged otherwise. If a move was done before, the first move can be omitted.

Strategy 1 [S1]: 012-S3-012-S3 opens the door iff all three dials read different numbers. 012 turns any rotation of 012 into some rotation of 021, any rotation of 021 into three equal dials, and any table with two equal dials into a different table with two equal dials.

Strategy 2 [S2]: 001-S3-S1-001-S3-S1 opens the door if two numbers are the same. Call 001, 112, and 220 "low pairs", and 110, 221, and 002 "high pairs". 001 turns a low pair into a high pair, and a high pair into either three equal dials or three different dials.

The full strategy is then S3-S1-S2, or
111-111-111-012-111-111-012-111-111
001-111-111-012-111-111-012-111-111
001-111-111-012-111-111-012-111-111

• Well done! I'll post a follow-up problem today or tomorrow (-: Commented Sep 5 at 8:26
• And it is optimal since there are 27 cases at the start and each try knocks out at most one of them. Commented Sep 5 at 20:51
• @FlorianF Actually not quite! If the starting state was (say) 001, we can only say that it dies somewhere in the last third, but every turn there is a possibility. Similarly for most others. (Nonetheless, this is still the optimal length, since your observation would be correct if the table wasn't spinning, which is after all a possibility) Commented Sep 6 at 10:43
• We know that Florian's statement is true for any fixed sequence of rotations, so it must be true for a randomly chosen sequence. Commented Sep 6 at 12:07
• I suppose that is true if we regard the sequence of rotations as fixed from the start. But still, the phrasing suggests that we should be able to determine which starting state was eliminated at what point, and that is impossible to do (apart from the first two turns I guess) Commented Sep 6 at 12:22