# The Odds of Finding a SET in The Card Game SET®

SET® is a card game using a special deck of cards. (SET is a registered trademark of Cannei, LLC. SET cards © 1988 Cannei, LLC. All rights reserved. Used with permission from Set Enterprises, Inc.)

Initially, 12 cards are dealt face-up into a shared 4×3 layout, like this:

Players simultaneously try to find a SET: three cards in which each of the four features of the card (color, shape of symbols, number of symbols, and shading) have either all the same value or all different values.

For example, this is a SET:

All three cards have different colors; all have different symbols; all have different numbers of symbols; and all have the same shading.

This is not a SET:

All three cards have different colors; all are diamonds; all have one symbol; however, two have open shading and one is filled.

SET is a fun game, whether or not you have kids in middle school math class. (You can buy it here if you want; note it gets 85% 5-star reviews and 96% 4 or 5 stars.)

The rules say that when a SET of three cards is found, the three cards are removed and replaced by three more from the deck. If at any point there is no SET of three cards in the array, then 3 more cards are added. The instruction booklet says that the odds against there being no SET in 12 cards is 33:1, and the odds against no SET in 15 cards is a whopping 2500:1. However, in playing the game, we were stymied more often than that with 12 cards, and even once with 15 cards (as shown in this crappy cell-phone-photo):

So one of the following must be happening:

1. We were unlucky to get a one-in-2500 array of 15 cards in our first day of playing.
2. We didn't recognize a SET that is actually there.
3. The instruction book is completely wrong.
4. The instruction book correctly gives the odds for an initial deal of 12 (or 15) cards, but in the course of playing the game, removing SETs and adding more cards. the odds change.

I hoped that the answer was 4, and I built a simulation to check. Here are the results—First, when dealing 12 (or 15) cards into a fresh layout and checking whether there is a SET, I get:

```Size |  SETs  | NoSETs | SET:NoSET ratio for initial layout
-----+--------+--------+----------------
12 | 96,701 |  3,299 |   29:1
15 | 99,962 |     38 | 2631:1
```
This agrees reasonably well with the ratios stated in the instructions (33:1 and 2500:1). But now if we simulate playing a game, removing SETs and replacing them with new cards, and tallying how often there is or is not a SET with an array of different sizes, we get:
```Size |  SETs  | NoSETs | SET:NoSET ratio for game play
-----+--------+--------+----------------
12 | 86,260 |  5,692 |   15:1
15 |  5,433 |     48 |  113:1
18 |     47 |      0 | inft:1
```
These ratios are quite different. The chances for finding no SET among 12 cards has doubled. And the odds of finding no SET with 15 cards has jumped by 20-fold. Thus, it seems the answer is my choice 4—the odds change over th course of a game.

Two problems remain. The first is to update the odds in the instruction booklet. I've let the good folks at setgame.com know, and hope they can fix it in the next printing.

But more interesting is the problem of why the odds change so dramatically. At first I thought it was because players were picking up the "good" cards to make SETs, leaving the "poor" cards, which are less likely to make a SET. But what makes a card good or poor? As Gregory Quenell points out in this presentation, each of the 81 cards participates in the same number of SETs, 40, and each pair of cards participates in exactly one SET. (That means there is a total of 1080 distinct SETs: 81 × 80 × 1 / 3! = 1080.)

So there is no such thing as a "good" card, or a "good" pair of cards. Instead, I think what is happening is that when the initial 12 cards are dealt, there might be 0, 1, 2, or more SETs in the array. If there was 1, then when you pick up that SET and replace it with three new cards, you only get three chances to form a SET with one of the new cards. The act of picking up a set makes it less likely that a set remains in the array, and the odds of generating a new set are somewhat lower since you only get 3 shots at it.

I did another experiment where I tallied the results only for layouts where there are no SETs in the initial *n*-3 cards; I then add 3 cards and see if there is a SET. Here's what I found:

```Size |  SETs  | NoSETs | SET:NoSET ratio for initial layout, but no SETs before dealing last 3 cards
-----+--------+--------+----------------
12 | 26,415 |  3,330 |    8:1
15 |  3,294 |     36 |   92:1
```
The results for an array of size 15 is roughly the same as when we play the game normally, which it should be, because in playing the game normally we only go to 15 cards when there is no SET in 12 cards. But the ratio for an array of size 12 shows half as many SETs as in playing the game normally, and a quarter as many as the initial deal. I take this as evidence that supports my theory that the ratio of no-SETs goes up as SETs are removed from the array.
Peter Norvig