==> decision/rotating.table.s <==
1. Turn two adjacent glasses up.
2. Turn two diagonal glasses up.
3. Pull out two diagonal glasses. If one is down, turn it up and you're done.
If not, turn one down and replace.
4. Take two adjacent glasses. Invert them both.
5. Take two diagonal glasses. Invert them both.
References
"Probing the Rotating Table"
W. T. Laaser and L. Ramshaw
_The Mathematical Gardner_,
Wadsworth International, Belmont CA 1981.
... we will see that such a procedure exists if and
only if the parameters k and n satisfy the inequality
k >= (1-1/p)n, where p is the largest prime factor
of n.
The paper mentions (without discussing) two other generalizations:
more than two orientations of the glasses (Graham and Diaconis)
and more symmetries in the table, e.g. those of a cube (Kim).