Problem 51451. Guess the card in Fitch Cheney’s five-card trick

Matilda and Labrun decide to amaze their many neighbors with a card trick. Matilda draws five cards, chooses one, arranges the others as shown below, and hands them to her brother. Labrun considers them for a moment and announces, “Two of clubs!” The neighbors are suitably impressed but wary that the wily siblings are probably up to their usual mathematical tricks.
This card trick exploits the pigeonhole principle, modular arithmetic, and permutations. With five cards (“pigeons”) and four suits (“holes”), a repeated suit is guaranteed. The first card below indicates the suit. The remaining three cards indicate the distance of the chosen card from the first card. If the cards in a suit are ordered clockwise in a circle--ace, 2 through 10, jack, queen, and king, then a 2 is four cards from the jack.
Because each suit has thirteen cards, one can always choose a card that is six cards or fewer in a clockwise direction from the other card of the same suit. The remaining three cards of the four handed to the partner are labeled bottom (B), middle (M), and top (T) by sorting first alphabetically by suit (clubs, diamonds, hearts, spades) and then numerically as above. Then the distance can be signaled as BMT = 1, BTM = 2, MBT = 3, MTB = 4, TBM = 5, TMB = 6.
In the example below, the bottom, middle, and top cards are the ace of diamonds, eight of diamonds, and six of hearts, respectively. Therefore, the arrangement is MTB, or a distance of four.
Write a function that takes a string of four cards and determines the chosen card. The input string for the example would be ‘JC 8D 6H AD’, and the output should be ‘2C’.

Solution Stats

45.0% Correct | 55.0% Incorrect
Last Solution submitted on May 17, 2023

Solution Comments

Show comments

Problem Recent Solvers3

Suggested Problems

More from this Author244

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!