The card game memory, aka concentration, is a children’s game that tests visual recall ability.

There are n pairs of cards face down. The first player flips over 2 cards to make a pair. If a match is made, the player keeps the cards, gets 1 point, and goes again. If not, the player flips the cards over and the next player goes, playing by the same rules. The game ends when all pairs are made and the person with the most points wins. (In this version, the goal is to maximize the point total).

In 1993 the best strategy for the game was solved, assuming players have perfect memory (they remember every card that was flipped) and play a zero sum game to maximize the expected number of matches (+1 means match for you and -1 means match for opponent).

It turns out there are some surprising moves: sometimes you will want to sacrifice your turn by intentionally not making a match! The reason is it can be strategically smart not to flip over new cards in some situations to prevent your opponent from gaining information.

I made a video that explains the best strategy and whether you want to go first or second.

Best Way To Play Memory (Card Game) According To Math

I summarize some of the points below.

.

.

"All will be well if you use your mind for your decisions, and mind only your decisions." Since 2007, I have devoted my life to sharing the joy of game theory and mathematics. MindYourDecisions now has over 1,000 free articles with no ads thanks to community support! Help out and get early access to posts with a pledge on Patreon. .

.



Types of moves

In a turn you flip over 2 cards. The moves are characterized by the maximum number of unknown cards you will flip.

The way most people play the game is by using “2-moves.” You flip over an unknown card and try to match it with one you have seen. If you cannot make a match, you then flip over a 2nd unknown card searching for a match.

Sometimes it is smarter to make a “1-move.” You flip over an unknown card and try to match it with one you have seen. If you cannot make a match, you flip over a known card that is not a match. In other words, a 1-move has a maximum of 1 unknown card turned up.

There is also the “0-move,” where you flip over 2 known cards that do not match! That is, you flip over 0 unknown cards. This amounts to passing on your turn. There are positions of the game where both players prefer a 0-move to avoid making a mistake and revealing a card location to the opposing player. The game essentially ends in a draw since no player wants to flip over an unknown card.

Example: 3 pairs of cards, 1 known

I show this in the video better, but let me try to explain it in text.

Suppose you have 3 pairs cards A, A, B, B, C, C shuffled on a table. You know the first card is an A. You flip over the second card as B. What is your best move?

Most of us would search the remaining 4 cards to find a match for B. This is a 2-move. What is the conditional expected value of completing a 2-move? There are 3 cases to consider.

–In 2/4 cases you get a C card and lose your turn. Now your opponent knows the location of A, B, and C, and each of the remaining cards will match. So your opponent will easily run the table and make 3 pairs. This is a disaster for you. Your expected value is -3.

–In 1/4 cases you get a B, so you get 1 point for sure. Then you are left with 4 cards, of which you know the location of one A. The value to the game will be X.

–In 1/4 cases you get the other A. You lose your turn, and you have guaranteed your opponent pairs the A cards (-1 to you). Then your opponent has 4 cards, of which he knows the location of one B. The value to the game will be -X since this is the mirror situation of the last case, but your opponent is playing.

The second and third cases have opposite expected values so they net to 0.

The expected value of a 2-move is therefore (2/4)(-3) = -1.5.

This is not good: you are expected to make 1.5 fewer pairs than your opponent.

What if you did a 1-move instead? You give up your turn by flipping over the A. Now your opponent has 6 cards and knows the location of one A and one B.

What’s the conditional expected value?

–In 2/4 cases your opponent matches either the A or the B, so it’s a -1 to you. Then the game has 4 cards, of which one is still known. I will skip the details, but there is a 2/3 chance your opponent makes both of these (-2), and then a 1/3 chance they mess up so you make these (+2).

–In 2/4 cases your opponent gets a C. If the opponent uses a 1-move, then you will run the table and get all 3. So instead the opponent will use a 2-move and hope to find the other C card. There is a conditional 1/3 chance of that, and then the opponent runs the table (-3). There is also a conditional 2/3 chance of messing up, in which case you run the table (+3).

The expected value is therefore:

(2/4)[-1 + (2/3)(-2) + (1/3)(+2)] + (2/4)[(1/3)(-3) + (2/3)(3)] = -1/3 = -0.333…

A 1-move is actually better! Your loss is -0.333 versus that of a 2-move which is -1.5.

Optimal strategy

The game has been solved by computer (Zwick and Paterson 1993). The optimal strategy is defined in terms of the pairs of cards n and the number of known cards k. Here is how to decide which move to make.

Play a 2-move if k = 0 (there is no other choice) or if n + k is odd. There is one special case exception: for n = 6 and k = 1 you should do a 1-move.

Play a 1-move if k ≥ 1 and n + k is even. Also do a 1-move for n = 6 and k = 1.

Play a 0-move if n + k is odd and k ≥ 2(n + 1)/3. This happens when the number of known cards is relatively large to the number of pairs. The intuition is you don’t want to risk flipping a card since you might make a mistake and your opponent will then make many pairs. An example is if you have 5 pairs and there are 4 known cards.

Playing first or second?

The paper also analyzed the expected value to the game.

If n is 1, 6, or an odd number 7 or larger, it is best to go first. The expected value to the first player is about 1/(4n + 2).

Otherwise, it is best to go second. If n is 2, 3, 4, 5, or an even number 8 or larger, it is best to go first. The expected value to second player is about 1/(4n – 2).

This is a zero sum game, so the expected value to the other player is the negative value.

Note the expected value is roughly 1/(4n). A fair game has a value of 0 to both players, so the game of memory is almost fair with a slight edge to one of the players.

Now you know the best way to play and whether you should go first or second, so go out and dominate some people in the game of memory!

Credits

U. Zwick and M. S. Paterson, The memory game. Theoretical Computer Science, 110 (1993):169-196

http://www.sciencedirect.com/science/article/pii/030439759390355W

SPECIAL THANKS TO Possibly Wrong! Check out this excellent post that provides details and references to other papers on this topic as well: https://possiblywrong.wordpress.com/2011/10/25/analysis-of-the-memory-game/

I read about the 3 pairs, 1 known example from the chapter on Memory in the book “Luck, Logic, and White Lies: The Mathematics of Games” by Jorg Bewersdorff. http://amzn.to/VIHHkt