A deck of cards

One time when I was in grad school, I was a teaching assistant for a business math class that included calculus and a smattering of other topics, including a little bit of probability. I made up examples involving a deck of cards, but then learned to my surprise that not everyone was familiar with playing cards. I was young and had a lot to learn about seeing things through the eyes of other people.

Later I learned that a “standard” deck of cards is not quite as standard as I thought. The “standard 52-card deck” is indeed standard in the English-speaking world, but there are variations used in other countries.

The Unicode values for the characters representing playing cards are laid out in a nice pattern. The last digit of the Unicode value corresponds to the point value of the card (aces low), and the second-to-last digit corresponds to the suite.

The ace of spades has code point U+1F0A1, and the aces of hearts, diamonds, and clubs have values  U+1F0B1, U+1F0C1, and U+1F0D1 respectively. The three of spades is U+1F0A3 and the seven of hearts is U+1F0B7.

But there’s a surprise if you’re only away of the standard 52-card deck: there’s a knight between the jack and the queen. The Unicode values for jacks end in B (Bhex = 11ten) as you’d expect, but queens end in D and kings end in E. The cards ending in C are knights, cards that don’t exist in the standard 52-card deck.

Here’s a little Python code that illustrates the Unicode layout.

for i in range(4):
   for j in range(14):
     print(chr(0x1f0a1+j+16*i), end='')
   print()

The output is too small to read as plain text, but here’s a screen shot from running the code above in a terminal with a huge font.

Unicode cards

Playing cards have their origin in tarot cards, which are commonly associated with the occult. But John C. Wright argues that tarot cards were based on Christian iconography before they became associated with the occult.

2 thoughts on “A deck of cards

  1. It’s interesting that Unicode doesn’t include the European playing card suits not used in the Anglo-French deck: leaves, shields, roses, acorns, bells, cups, coins, rods, and swords. There are always four non-trump suits, so I suppose this is something you could do at the font level.

  2. The C in the knight stands for “Cavalier”, French for knight. Tarot decks are popular in France as a card game, similar to bridge except you don’t nominate a suit as trumps but instead the atouts, cards numbered 1 through 21, as well as a special card called l’Excuse, are always trump cards, and they are also present in Unicode. Those are the cards that are the arcana in the occultist tarot decks. It was a very popular pastime when I was in college there.

    Here is a good set of rules:
    https://www.pagat.com/tarot/frtarot.html

Leave a Reply

Your email address will not be published. Required fields are marked *