[Go to main page]

## How to remember playing cards with binary and hex

The following is a way to remember which playing cards have been dealt from a pack of cards. The method reduces a whole pack to just 13 numbers or letters. Instead of having to remember sentences such as "king of spades, king of clubs", you just need to remember a number or a letter for each type of card. For example, you can summarise which kings have been dealt by remembering one letter or number. You could remember which kings and which queens have been dealt by remembering two letters or numbers. You could remember an entire pack by remembering 13 letters or numbers, although doing that still takes some skill.

The downside to this method is that it requires a good understanding of hexadecimal and binary and the ability to convert from one to the other quickly. The more you practise this, the easier it becomes to convert the numbers, and the easier it is to visualise the binary strings in your head.

The basis of the idea is that each type of card (e.g. kings, twos, aces etc) for the four suits (spades, clubs etc) is kept in your mind as a 4-bit binary number. A "one" indicates that a particular card has been dealt, and a "zero" indicates that that card has not been dealt. As a 4-bit binary number is also a single hex digit, you just need to remember a single hex digit for each type of card. When a new card is dealt, you convert the hex to binary, change the relevant bit, then change it back to hex. The whole idea is based around a table of all the playing cards in a pack. To start with, you need to order the suits in a way that you will always remember. I use the order of spades, clubs, hearts, diamonds. This order can be remembered by the colours and shapes. It goes:

"black, simple and rounded"

"black, not simple and rounded"

"red, simple and rounded"

"red, not simple and rounded"

The table looks like this:

Each row in the table can be treated as a 4-bit binary number, and that, in turn, can be treated as a single digit hex number. If you can easily remember 13 letters or numbers, then you can remember the entire grid. Otherwise, you can just concentrate on remembering a subset of the table, such as kings, queens and jacks.

As the cards are dealt, you fill in the table with a 1 for a card that has been dealt, and you leave a 0 for a card that is yet to be dealt. If the king of clubs and the king of diamonds have been dealt, but not the kings of spades and hearts, the row for kings would look like this:

This can then be written as "0101" in binary. This is the same as "5" in hex, or "0x05" or "5h" depending on whether you are a C programmer or an assembly language programmer. Therefore, to remember how many kings have been dealt, you only need to remember the number "5". One number indicates the presence or absence of four different cards.

Here is a chart for converting from hex to binary for 4-bit numbers: (It is never necessary to convert to decimal numbers, and doing so would just complicate things).

As more kings are dealt, you swap the zeroes in the binary number with ones. At any point, you can tell from the binary number which kings have been dealt and which are still in the pack. Technically, when a new king is dealt you are "Or"-ing the number with either 8, 4, 2 or 1.

To start with, you will need to keep converting the hex number to binary in order to fill in another bit, and then convert it back to hex in order to remember it. With more practice, you will be able to alter the hex number directly without needing to convert to and from binary. It can be hard to do this quickly at first, but it gets a lot easier as you do it more often. There are some useful facts that help with this:

- If you get a new diamond, you know that you only have to add 1 to the number in your head.

- It becomes easier to convert from hex to binary if you think of the patterns. For example, "c" is "1100" whilst "3" is "0011".

- If you have "7", then you know you are waiting for the spade.

- If you have "e", then you know you are waiting for the diamond.

- If you have "f", then you have all of that type of card.

The easiest way to develop the method is to start by remembering just kings, queens and jacks. By doing that, you will have just three hex digits to remember, and you can concentrate on the maths instead of the remembering. When you are proficient with three digits, you can practise remembering longer sequences of digits.

## A simple example

Here we will just keep track of the kings and queens. This means that we only have to remember two letters or numbers.

Here are all the kings and queens shuffled:

We have no kings or queens of any suit. At the moment, our grid looks like this:

The king number is "0000" in binary, which is "0" in hex. The same is true for the queen number. Therefore, we just remember the king number followed by the queen number, which is "00".

Next, the first card is turned over:

This is the king of diamonds. We fill its entry in our grid.

The king number is now "0001" in binary, which is "1" in hex.

The queen number is still "0000", which is "0" in hex.

Therefore, we just remember the king number followed by the queen number, which is "10".

The next card is turned over:

This is the king of clubs. We fill its entry in the grid:

The king number is now "0101" in binary, which is "5" in hex.

The queen number is still "0000", which is "0" in hex.

As before, we just need to remember the king number followed by the queen number, which is "50".

The next card is turned over

The card is the king of Spades. We set the relevant entry in the table to one:

The king number is now "1101" in binary, which is "d" in hex.

The queen number is still "0000", which is "0" in hex.

The number we have to remember is "d0".

The next card is turned over:

The card is the queen of clubs. Our table now looks like this:

The king number is still "1101" in binary or "d" in hex.

The queen number is now "0100", which is "4" in hex.

The number we have to remember is "d4".

The next card is turned over:

It is the queen of diamonds. Our table now looks like this:

The king number is still "1101" in binary or "d" in hex.

The queen number is now "0101", which is "5" in hex.

The number we have to remember is "d5".

The next card is turned over:

It is the king of hearts. Our table now looks like this:

The king number is now "1111" in binary, which means that we have all the kings. This is "f" in hex.

The queen number is still "0101" or "5" in hex.

The number we have to remember now is "f5".

Now we can make the best use of this method of remembering cards. We know which cards have been dealt, and we can work out which cards are left in the pack by just seeing where the zeroes are in the table. We have all the kings, which we can tell by the king number being "f" or "1111" in binary. The queen number is "5", which is "0101" in binary. This means that we are still waiting for the queen of spades and the queen of hearts.

Turning over the last two cards, we can see that we were right:

If you have an entire pack of cards, and remember all the kings, queens and jacks as you go through it, then you can slightly impress people by saying which of these are left in the pack at any moment in time. The more rows you can add to the table in your head, the more impressive it is. People generally assume you are performing a trick, but they might be more impressed if they knew what you were really doing.

I don't know enough about card games to know how useful it is to remember a portion or all of a pack of cards, but it's still an interesting pursuit.

[Go to main page]

[Contact]

The downside to this method is that it requires a good understanding of hexadecimal and binary and the ability to convert from one to the other quickly. The more you practise this, the easier it becomes to convert the numbers, and the easier it is to visualise the binary strings in your head.

The basis of the idea is that each type of card (e.g. kings, twos, aces etc) for the four suits (spades, clubs etc) is kept in your mind as a 4-bit binary number. A "one" indicates that a particular card has been dealt, and a "zero" indicates that that card has not been dealt. As a 4-bit binary number is also a single hex digit, you just need to remember a single hex digit for each type of card. When a new card is dealt, you convert the hex to binary, change the relevant bit, then change it back to hex. The whole idea is based around a table of all the playing cards in a pack. To start with, you need to order the suits in a way that you will always remember. I use the order of spades, clubs, hearts, diamonds. This order can be remembered by the colours and shapes. It goes:

"black, simple and rounded"

"black, not simple and rounded"

"red, simple and rounded"

"red, not simple and rounded"

The table looks like this:

Spades |
Clubs |
Hearts |
Diamonds | |

King | 0 | 0 | 0 | 0 |

Queen | 0 | 0 | 0 | 0 |

Jack | 0 | 0 | 0 | 0 |

10 | 0 | 0 | 0 | 0 |

9 | 0 | 0 | 0 | 0 |

8 | 0 | 0 | 0 | 0 |

7 | 0 | 0 | 0 | 0 |

6 | 0 | 0 | 0 | 0 |

5 | 0 | 0 | 0 | 0 |

4 | 0 | 0 | 0 | 0 |

3 | 0 | 0 | 0 | 0 |

2 | 0 | 0 | 0 | 0 |

Ace | 0 | 0 | 0 | 0 |

Each row in the table can be treated as a 4-bit binary number, and that, in turn, can be treated as a single digit hex number. If you can easily remember 13 letters or numbers, then you can remember the entire grid. Otherwise, you can just concentrate on remembering a subset of the table, such as kings, queens and jacks.

As the cards are dealt, you fill in the table with a 1 for a card that has been dealt, and you leave a 0 for a card that is yet to be dealt. If the king of clubs and the king of diamonds have been dealt, but not the kings of spades and hearts, the row for kings would look like this:

Spades |
Clubs |
Hearts |
Diamonds | |

King | 0 | 1 | 0 | 1 |

This can then be written as "0101" in binary. This is the same as "5" in hex, or "0x05" or "5h" depending on whether you are a C programmer or an assembly language programmer. Therefore, to remember how many kings have been dealt, you only need to remember the number "5". One number indicates the presence or absence of four different cards.

Here is a chart for converting from hex to binary for 4-bit numbers: (It is never necessary to convert to decimal numbers, and doing so would just complicate things).

Hex | Binary |

1 | 0001 |

2 | 0010 |

3 | 0011 |

4 | 0100 |

5 | 0101 |

6 | 0110 |

7 | 0111 |

8 | 1000 |

9 | 1001 |

a | 1010 |

b | 1011 |

c | 1100 |

d | 1101 |

e | 1110 |

f | 1111 |

As more kings are dealt, you swap the zeroes in the binary number with ones. At any point, you can tell from the binary number which kings have been dealt and which are still in the pack. Technically, when a new king is dealt you are "Or"-ing the number with either 8, 4, 2 or 1.

To start with, you will need to keep converting the hex number to binary in order to fill in another bit, and then convert it back to hex in order to remember it. With more practice, you will be able to alter the hex number directly without needing to convert to and from binary. It can be hard to do this quickly at first, but it gets a lot easier as you do it more often. There are some useful facts that help with this:

- If you get a new diamond, you know that you only have to add 1 to the number in your head.

- It becomes easier to convert from hex to binary if you think of the patterns. For example, "c" is "1100" whilst "3" is "0011".

- If you have "7", then you know you are waiting for the spade.

- If you have "e", then you know you are waiting for the diamond.

- If you have "f", then you have all of that type of card.

The easiest way to develop the method is to start by remembering just kings, queens and jacks. By doing that, you will have just three hex digits to remember, and you can concentrate on the maths instead of the remembering. When you are proficient with three digits, you can practise remembering longer sequences of digits.

Here are all the kings and queens shuffled:

We have no kings or queens of any suit. At the moment, our grid looks like this:

Spades |
Clubs |
Hearts |
Diamonds | |

Kings |
0 | 0 | 0 | 0 |

Queens |
0 | 0 | 0 | 0 |

The king number is "0000" in binary, which is "0" in hex. The same is true for the queen number. Therefore, we just remember the king number followed by the queen number, which is "00".

Next, the first card is turned over:

This is the king of diamonds. We fill its entry in our grid.

Spades |
Clubs |
Hearts |
Diamonds | |

Kings |
0 | 0 | 0 | 1 |

Queens |
0 | 0 | 0 | 0 |

The king number is now "0001" in binary, which is "1" in hex.

The queen number is still "0000", which is "0" in hex.

Therefore, we just remember the king number followed by the queen number, which is "10".

The next card is turned over:

This is the king of clubs. We fill its entry in the grid:

Spades |
Clubs |
Hearts |
Diamonds | |

Kings |
0 | 1 | 0 | 1 |

Queens |
0 | 0 | 0 | 0 |

The king number is now "0101" in binary, which is "5" in hex.

The queen number is still "0000", which is "0" in hex.

As before, we just need to remember the king number followed by the queen number, which is "50".

The next card is turned over

The card is the king of Spades. We set the relevant entry in the table to one:

Spades |
Clubs |
Hearts |
Diamonds | |

Kings |
1 | 1 | 0 | 1 |

Queens |
0 | 0 | 0 | 0 |

The king number is now "1101" in binary, which is "d" in hex.

The queen number is still "0000", which is "0" in hex.

The number we have to remember is "d0".

The next card is turned over:

The card is the queen of clubs. Our table now looks like this:

Spades |
Clubs |
Hearts |
Diamonds | |

Kings |
1 | 1 | 0 | 1 |

Queens |
0 | 1 | 0 | 0 |

The king number is still "1101" in binary or "d" in hex.

The queen number is now "0100", which is "4" in hex.

The number we have to remember is "d4".

The next card is turned over:

It is the queen of diamonds. Our table now looks like this:

Spades |
Clubs |
Hearts |
Diamonds | |

Kings |
1 | 1 | 0 | 1 |

Queens |
0 | 1 | 0 | 1 |

The king number is still "1101" in binary or "d" in hex.

The queen number is now "0101", which is "5" in hex.

The number we have to remember is "d5".

The next card is turned over:

It is the king of hearts. Our table now looks like this:

Spades |
Clubs |
Hearts |
Diamonds | |

Kings |
1 | 1 | 1 | 1 |

Queens |
0 | 1 | 0 | 1 |

The king number is now "1111" in binary, which means that we have all the kings. This is "f" in hex.

The queen number is still "0101" or "5" in hex.

The number we have to remember now is "f5".

Now we can make the best use of this method of remembering cards. We know which cards have been dealt, and we can work out which cards are left in the pack by just seeing where the zeroes are in the table. We have all the kings, which we can tell by the king number being "f" or "1111" in binary. The queen number is "5", which is "0101" in binary. This means that we are still waiting for the queen of spades and the queen of hearts.

Turning over the last two cards, we can see that we were right:

If you have an entire pack of cards, and remember all the kings, queens and jacks as you go through it, then you can slightly impress people by saying which of these are left in the pack at any moment in time. The more rows you can add to the table in your head, the more impressive it is. People generally assume you are performing a trick, but they might be more impressed if they knew what you were really doing.

I don't know enough about card games to know how useful it is to remember a portion or all of a pack of cards, but it's still an interesting pursuit.

[Go to main page]

[Contact]