WoodCentral Forums

Est. 1998 — 27 years of woodworking knowledge

Tuesday Puzzle

Posts

Tuesday Puzzle

#1

Tuesday Puzzle

Dan Donaldson

Say that I have a machine that will shuffle a deck of cards. It is not actually random, but generates a repeatable pattern, although, the result can be considered shuffled, especially if the input is not known.

The question is:

I have 13 cards of one suit arranged from ace to king. I feed them through the machine, then take the result and feed it through again. After the second pass, the order of the cards is 10,9,Q,8,K,3,4,A,5,J,6,2,7. What was the order after the first pass through the machine?

Re: Tuesday Puzzle

#2

Answer in code

Alex Y

The "code" is the obvious, but at least the answer is hidden from those who don't want to see it yet!

BHGCJMFLAIEDK

I'm more confident in my answer than in my encoding of it!

Re: Tuesday Puzzle

#3

Re: Answer in code ;(

Dan Donaldson

If I am reading your code correctly, it does not work for me.

Re: Tuesday Puzzle

#4

Spoiler alert, uncoded answer

Alex Y

You missed the fact that it was doubly-encoded. But I'm too honest to claim to have done it intentionally. What I gave was not the cards in each position, but the position of each card. I.e., the B in the first spot doesn't translate to the two being the first card, but rather that the A is in position 2, the 2 in position 8, etc.

The order of the cards is

9, A, 4, Q, J, 7, 3, 2, 10, 5, K, 8, 6

Re: Tuesday Puzzle

#5

 


Re: Tuesday Puzzle

#6

Question for Alex or Dan

Larry Barrett

How did you go about solving this? I assumed that the shuffle had to work the same way each time, and your solution demonstrates this, but I could not see how to get started. Is there some logic to the solution, or was trial and error the way to go.

Re: Tuesday Puzzle

#7

Method

Alex Y

I figured that the shuffling machine would return the cards to their original order in 13 shuffles. This can be seen by cycling through all the cards in the double shuffle shown. A->position 8, 8-> position 4, 4-> position 7, ..., 10 -> position 1. There are no "loops" shorter than the full 13.

The single shuffle will get back to the original position after 13 repeats. After 14 repeats, it will get to the desired 1-shuffle order. So do the double shuffle (the map for which is provided) seven times to get the desired position.

Last step for me was to check the result and be pleasantly surprised that it worked!

Re: Tuesday Puzzle

#8

Very clever - thanks 


Re: Tuesday Puzzle

#9

Another way

Dan Donaldson

Alex's method is more elegant, but another way is to just try something, then see what happens. In most cases, you will find a contradiction very quickly.

For example, suppose that the first move is the ace to position 4. That means that the top of the second row must be the fourth one down on the last row, or the 10. Keep up and you quickly run into a contradiction. If your first assumption is the ace goes from 1st position to second in the next row, everything comes out OK and that is the pattern. At most, you would need to look at 12 cases, and all but one fairly quickly lead to problems.

👍 This page answered my questions

Your vote helps other woodworkers quickly find the answers and techniques that actually work in the shop.