Home > Mathematica, Mathematics > Playing with a full deck: solution (illustration)

Playing with a full deck: solution (illustration)

The algorithm for revealing the four cards in the solution explanation post can be summarized as follows:

  1. Pick a pair of  cards of the repeated suits (guaranteed by the pigeonhole principle).
  2. Chose the hidden card as the card \leq6 cards from the first card (guaranteed by modular arithmetic).
  3. Lexicographically order the remaining three cards to code the number of cards ahead of the first card the hidden card sits.

I used Mathematica to:

  • import and process the card images
  • to map cards to  suits and values
  • to encode the algorithm above (with assumptions about hidden ahead or behind (  difference  between first card and hidden card positions as  [hidden -first] was used) and the suit ranking: club < diamond < heart < spade)
  • to randomly select 5 cards from deck without replacement and visualize algorithm to illustrate it

I stress the choice of cards ahead/behind and suit rankings (24 possible) are arbitrary. They must be agreed upon between the magician and the assistant prior to the trick.

Click on the image to enlarge.

Advertisements
Categories: Mathematica, Mathematics
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: