Position Numbering: Position 1 is the TOP card of the deck. Position 52 is the BOTTOM card (for a 52-card deck).
Alex Elmsley discovered that you can move the top card to any position in a deck using a sequence of perfect faro shuffles.
Persi Diaconis formalized the mathematics and extended it to move cards from any position to any other position.
Basic Elmsley Method (from top): Convert the target position to binary, then:
General Case: This simulator finds the shuffle sequence to move ANY card from position X to position Y.
Symmetry Exploration: Since faro shuffles cut the deck exactly in half, there's a natural symmetry. Position 29 (3rd card of bottom half) relates to position 3 (3rd card of top half). Enable the symmetry checkbox to explore whether the same sequence works for both!
Out-Shuffle: Top and bottom cards stay in place. Cards interweave starting from the outside.
Position transformation: x → 2x mod (n-1) for middle cards
In-Shuffle: Top card moves to second position. Cards interweave from the inside.
Position transformation: x → 2x + 1 mod n
Binary Magic: Each in-shuffle adds a '1' bit, each out-shuffle adds a '0' bit to the position!
Example: Try moving from position 1 to position 6 with an 8-card deck (binary 101 = In, Out, In)
Algorithm Used:
Note: Some position combinations may require many shuffles (up to 30 checked). BFS guarantees the shortest sequence found.