# Game, SET and maths

Once a month my friends and I meet to have a drink in our local pub, and to discuss mathematics (of course). As part of our monthly MathsJam (for more information, and to see if there’s one near you, visit mathsjam.com) we solve puzzles, work out mathematical proofs and discuss interesting ideas. We also often play games, and one particular favourite – that usually comes out when new attendees join us – is the game of SET.

SET is a simple card game, which was designed by geneticist Marsha Falco in 1974. The original idea came when Marsha was comparing genetic traits in dogs, and devised a system of symbols drawn on cards, to track the different genetic features, and found a fun game could be made by finding sets of cards with particular traits. After refining the game, playing it with family and friends, Marsha started her own company and published the game commercially in 1990. While the game itself is simple and can be played by anyone with a few minutes of explanation of the rules, there are many interesting underlying mathematical ideas and structures.

The game consists of a deck of cards, each containing symbols with different properties. Looking at these sample cards, you can see that the four possible properties a symbol can have are: colour, shape, number and shading. Each of these four properties can be one of three things:

• Colour: symbols can be red, green or purple
• Shape: symbols can be a diamond, squiggle or oval thingy (if you want a proper name for it, it’s called a stadium, but is apparently sometimes called an obround, or a discorectangle, which is my new favourite word)
• Shading: symbols can be blank, striped or filled
• Number: there can be one, two or three symbols on the card

This means that for each card, each of these four properties is set to one of these three values, and in a standard deck of SET cards, exactly one of each possible card is present. If you’d like to take a moment to work out how many cards there must be in a SET deck, please go and do that now before reading on. I’ll put the answer at the bottom of this post.

Given a structure like this, you can arrange the cards in rows which share properties. For a simple example, imagine taking only part of the deck (a sub-SET, if you will) in which all the cards are green, and filled in, and arranging them in a square. You could set up the square so that each row contains cards with the same number of symbols, and each column contains cards with the same shape.

If we wanted to include more cards, we could create a version of this 2D array for each of the three shadings, and then stack them on top of each other, to form a 3D cube.

To include the red and purple cards as well, we’d need three such cubes – and you can think of this as a hypercube: a four-dimensional cube, in which the colour axis extends off in to 4D, and you can’t visualise it as a single object in our limited 3D universe, but the three different cubes are ‘lying on top of each other’ in 4D, just as the square arrays stack up to make the 3D cube (and by analogy, the way the straight line sets of three cards stack up to make each square).

I’m not even going to attempt a diagram of this, so here’s a photo of a cute kitten

This underlying structure is barely noticeable to anyone just casually playing the game, but it is there, and in fact many familiar games can be abstracted in this way – for example, the game Dobble, marketed in the US as Spot-It, has a superb mathematical structure called a projective plane which underlies the way the symbols are arranged on the cards. But that’s a story for another time. I haven’t even told you how to play this game yet!

### How to play

Gameplay involves competing to find a SET, where the definition of a SET is a specific combination of three cards, as follows: For each of the four properties, the three cards in the SET have to either be all the same for that property, or all different. For example, the cards could be all red, or there could be one red/one green/one purple. This has to also hold for each of the four properties – so you could have, say, all cards with three symbols on, or cards with 1, 2 and 3 symbols on. You can combine ‘same’ and ‘different’ across the four properties, as long as each individual property has the cards all the same, or all different.

If you’re not quite sure what that means just yet, make sure you untangle it – it’s a slightly knotty concept at first, but it’s equivalent to saying that in any collection of three cards, if you can see two cards which share a property that the third one doesn’t, it’s not a SET. Some examples of valid and invalid SETs are given in the diagrams below.

Valid SETs

Not valid SETs

Sadly, we weren’t on table number 4D

If you consider the 4D hypercube of cards we constructed earlier, each of the rows and columns (and whatever you call the lines running in the other two directions) of that hypercube will give a valid SET, as will any diagonals (of which there are quite a few, including diagonals within the layers – if you want to work it out, I’ll put how many there are at the bottom of the post).

If you rearrange the hypercube, by changing the order in which you put the rows and columns and whatevers and thingybobs, you’ll get another valid SET hypercube which will consist of all valid SETs too, and this can be done in many different ways. We had a go at laying out the cards in such a hypercube in the pub once, but we had to do it as nine separate squares on the table, so you have to imagine the fourth dimension.

If you’re playing with a group of people (for example, in a pub) you can start the game by dealing 12 cards onto the table. Then, if someone in the group thinks they’ve found a SET, they can shout ‘SET!’ and claim their three cards. (We’ve found through experience that requiring a clear audible signal before reaching in for the cards drastically reduces the incidence of hand collisions and fingernail gouging from too-enthusiastic SET grabs). For any SETs you successfully claim, you can keep the cards, and if you mistakenly shout ‘SET’ but can’t find one, you have to give one card back to the dealer as a penalty. Whoever holds the most cards at the end is the winner.

### Some more puzzles

Any two cards in this game define a SET – much like the way in which any two points in 2D or 3D space define a unique line, and the two cards are points in the 4D space in which SET lives. Given two cards, it’s easy to work out what the third would be. Try these examples – what card should be at the bottom of each column? I’ll put the answers at the end of the post.

Finding the third card that’s missing from a SET like this is a nice exercise to practise and get better at spotting when a set of three cards is a SET. Each single card in SET is part of many different sets (go ahead and work out how many – I’ll put the answer at the bottom!) and since there are four properties that can be the same or different, there are different ‘levels’ of SET difficulty – the easiest being a SET where three of the four properties are the same and one is different, and the hardest where all four properties are all different. (It’s not possible to have a SET where all four properties are the same, as there’s only one of each card).

If you’d like to both test your mental agility and own a four-dimensional object that fits in a small box, you can buy copies of SET online from various places, and in (or so I’ve found) only the most excellent board game shops. It’s also been variously available as a mobile app in official SET enterprises and less official versions, so you can hone your skills before your next pub session.

There are plenty of other puzzles around the game too, many of which are outlined in a book, The Joy of SET, published in 2016 by a family of SET fans – including questions like, what’s the most cards you can deal out on the table and still not have a SET? And, what’s the probability that your initial deal of 12 will contain at least one SET? But of course the most important question you might ask yourself is, will we be able to fit in another game before the pub closes?

### Solutions

Here follow the answers to the little problems I’ve… SET you (sorry)… during this post.

##### How many cards in a standard SET deck?

If each card has three choices for each of the four properties, the number of possible cards is 3 × 3 × 3 × 3 = 81.

##### How many different diagonal lines are there in a 3 × 3 × 3 × 3 hypercube?

There are two diagonals in a 3 × 3 square, and to work out the number in a cube you can see there are two in each plane of the cube (three in each of three directions), giving 9×2=18 diagonals lying inside planes; then you simply need to count the diagonals running from corner to corner, and with eight corners on a cube there are 4, so a 3 × 3 × 3 cube has 22 diagonal lines within it. Then to go up to a hypercube, you’ll need 22 for each of the three cubes it contains, times the four dimensions, and then add the number of diagonals running between opposite corners – 8, pairing up the 16 vertices on a hypercube. So the total is (22 × 3 × 4) + 8 = 272.

##### How many SETs is one given card a member of?

For each card, there are 80 other cards in the deck it could be paired with. Picking each one of these 80 cards will give you two cards, which will define a SET. However, each of these SETs will be present twice, as you’ll get the same set whichever of the two other cards in it you pick, so you have to divide by two and find that each card is part of 40 sets.

### Posted by Katie Steckles

is a mathematician based in Manchester, who gives talks and workshops on different areas of maths. She finished her PhD in 2011, and since then has talked about maths in schools, at science festivals, on BBC radio, at music festivals, as part of theatre shows and on the internet. Katie writes blog posts and editorials for The Aperiodical, a semi-regular maths news site.

### 5 comments Write a comment

1. “Mind-Blowing” sozusagen, Dr. W räumt ein sich auch hier beraten gelassen zu haben; die Spielregeln sind womöglich nicht in einem WebLog-Eintrag direkt und stringent darzustellen :

Direkt klüger muss so womöglich niemand werden, also beim Spielen, dennoch bleibt kombinatorisches Denken berührt, und wer hätte schon etwas gegen dieses?

Ansonsten, i.p. Spielfreude darf an dieser Stelle womöglich auch an andere, womöglich vergleichbare Spiele wie “Quartett”, “Schwarzer Peter”, “Bingo” und Automatenspiele erinnert werden, bei denen bestimmte Muster-Folgen zum Spielgewinn führen.
“SET” bleibt, auch wenn es womöglich ein “Katzen-Spiel” ist, sehr nett, danke für die Vorstellung (“You are welcome”).
Es ist komplex.

MFG
Dr. Webbaer (der jetzt fast die Lust verspürte ein von ihm entwickeltes Poker-nahes Spiel vorzustellen, abär sparsam bleibt)

2. PS:
Kombinatorik und Topologie sind in der Lage Spiele anzuleiten, die vielen gefallen, denen jedoch meist die taktische und strategische Komponente fehlt, das direkt Kompetitive, insofern, ganz böse formuliert, womöglich “Cat-Games” anleiten.

Webbaer-Poker, erst letzte Woche entwickelt, geht so, vielleicht ist ein wenig Werbung an dieser Stelle erlaubt:
1.) Zwei Spieler besitzen anfänglich 100 Chips, sie entsprechen direkt einer (Geld-)Währung, also bspw. dem Gegenwert von einem Dollar oder einem Euro.
2.) Es liegt ein Kartenspiel vor, das genau aus drei (!) Karten besteht, es gibt die Overcard (die durch einen Joker bebildert sein darf), die Midcard (die bspw. durch ein Dollar- oder Euro-Zeichen bebildert sein darf) und die Lowcard (die bspw. durch eine Pflaume bebildert sein darf).
Die Overcard gewinnt immer, die Midcard gegen die Lowcard und die Lowcard nie.
3.) Zuerst wird eine Ante(-Bet), eine Vorwette von den beiden Spielern geleistet in Höhe von einem Chip.
4.) Dann werden die Karten verteilt und abwechselnd einer der beiden Spieler gebeten, wie eben im üblichen Poker, eine Wette (in beliebiger Höhe bis zur Gesamtzahl der besessenen Chips) zu leisten oder zu checken (also nicht zu wetten oder zu setzen).
5.) Auf diese Wette oder Bet darf von der anderen Seite durch Erhöhung (“Raise”), Bezahlen (“Call”) oder durch passen (“Fold”) reagiert werden, wird gepasst oder gefoldet wandert der gesamt eingesetzte Betrag, der Pot sozusagen, zum Spieler, der die höhere Karte hat, wird von beiden Spielern nicht gesetzt oder gewettet oder eine Bet oder Wette bezahlt (“gecallt”) wird verglichen, welche Karte höher ist und dem Besitzer der höheren Karte der gesamt eingesetzte Betrag, der Pot sozusagen, zugewiesen.

Wie beim klassischen No Limit-Poker.
Mehr ist nicht los, außer dass angemerkt werden muss, dass das Spielziel darin besteht möglichst viele Chips anzuhäufen.
Eine Abgabe (auch “Rake” genannt) an den Veranstaltungsleiter, der eine dritte Person sein darf, ist nicht vorgesehen.

Zur Spielstrategie, die sich hier anbietet, die das sog. Nash-Equilibrium zu meinen hat, dessen bestmögliche spielerische Implementation sozusagen, soll an dieser Stelle nichts angemerkt werden, außer dass es eben um “Nash” geht, in diesem kleinen minimalistischen Pokerspiel, Webbaer-Poker genannt und erst letzte Woche entwickelt.

3. PPS :
Also es wird jeweils eine (!) Karte von den dreien verfügbaren an die Spieler verteilt, so dass immer eine Karte am Spiel nicht teilnimmt.
(Dr. Webbaer ist, insbesondere im Feedback-Bereich, oft ein wenig ungenau, auch um nicht übertrumpfen zu wollen, sozusagen.
Dr. W lässt sich auch gerne, i.p. Webbaer-Poker, ergänzen, das vorgestellte Spiel müsste ohnehin teuflisch sein, und umfassende Spielbeschreibung hat stets schwierig zu bleiben.)

4. Dear Madam, regarding the question “How many different diagonal lines are there in a 3 × 3 × 3 × 3 hypercube?” I disagree with the 4-D-solution. The dimension factor is seemingly missing in your calculation. I found the following recursive formula:
d[k,n]=d[k,n-1]*k*n+2^(n-1), with d[k,1]=0, k=2,3,4,5,…, n=1,2,3,4,…
where “k” is the size of the edges in units of “elementary” cubes and “n” is the dimension, while d[k;n] is the number of diagonals found in the k^n-cube.
Results for k=3, n=2,3,4:
d[3,2]=2
d[3,3]=22
d[3,4]=22*3*4+8=272 (rather than 74!)
d[3,5]=4096
d[3,6]=73760
This sequence is not yet found in OEIS (;-)
Regards,
Ludwig.

5. Hi Ludwig
Good spot – I’ve missed out a factor of 4 in my calculation. I’ll amend this now. Thanks!