Suppose there is a table with three marked spots, $A, B, $ and $C$, on which playing cards can be put, face up. Initially, an ace (1), a deuce (2), and a trey (3) are placed on one or more of these spots, but it is not specified where they are placed.
Two or three cards might be in the same spot, one atop the other; in this case only the top card is visible. If you see the ace in spot $A$, and the deuce in spot $B$, and you see that spot $C$ is empty, then you know that the trey is under the ace or under the deuce, but not which. If you see that spots $A$ and $B$ are empty, and that the ace is in spot $C$, then you know that the deuce and the trey are in spot $C$ under the ace, but you don't know which is on the bottom of the pile. Thus there are 60 possible arrangements for the cards, but only 33 different ways that they can appear.
The problem is to produce an algorithm which guarantees to get all three cards onto spot $A$, with the ace on top, then the deuce, and the trey on the bottom, moving only one card at a time, and using no memory.
The algorithm should have the following form: for each of the 33 possible appearances of the table, it should specify that a certain visible card should be moved to a certain position, or halt. It should guarantee to achieve success in a bounded amount of time regardless of the initial layout of the cards. (Obviously, the bound must be less than 60 moves.) It does not have to halt on success; it is enough to guarantee that the cards will will reach the target position.
It is not too hard to come up with a solution to the problem just by tinkering, and indeed I have solved the puzzle. But I haven't ever been able to think of a good approach to solving it.
What are some effective approaches to solving this problem?
[ EDIT 2013-09-27: I had the success condition wrong before. The cards are supposed to be stacked up, not spread out. ]