This is one of the OLD POTM problems

Long version of the problem.

Information about the winner and the solution

Back to the list of problems.

Short Problem Description

deadline: june, 1994

Cards are lovely.  They have an order, a purpose, a reason.

But once you take them out of the box, and start CUTTING them, and
SHUFFLING them, and FLIPPING them ... it's real hard to get them
back to where they started!  That's the challenge of the next POTM!

For an illustration, let's assume I have a deck with only eight cards,
(call them ABCDabcd), let me define those operations a bit better:

	a CUT transforms	ABCDabcd -> abcdABCD
	a SHUFFLE transforms	ABCDabcd -> aAbBcCdD (top card changes)
	a FLIP transforms	ABCDabcd -> dcbaDCBA

The question:	What do I have to do to a deck that looks like: dbDBcaCA 
		to get it back into ABCDabcd original starting order?

The answer:  CUT, then SHUFFLE, then FLIP (obviously).

     dbDBcaCA -> caCAdbDB 
                 caCAdbDB -> dcbaDCBA
                             dcbaDCBA -> ABCDabcd	(voila!)

For the POTM, I'll give your program a deck in disarray (up to 52 cards).
Your program will have to tell me what operations to perform (CUTS, SHUFFLES,
and FLIPS) in order to return the deck to its pristine unmixed state.

Make your own free website on Tripod.com