How many tiles does this game have?

Peter Rowlett gets in a tangle … KNOT!

post

Sometimes I find an old game and it makes me notice or wonder something mathematical. For example, I found Rubik’s Tangle 2 in a charity shop.

In his memoir, Rubik describes a period after the initial cube craze died down where he worked on other puzzles, including this one. My copy of Tangle 2 is dated 1990, placing it within the second wave of the Rubik’s cube. On the box he explains that he hopes to “create things that challenge the mind—which everyone can play and enjoy”.

Tangle is a tile-based puzzle where the aim is to arrange the tiles into a square so that the ropes form continuous lines. You can see some example tiles in the header image.

At first I thought it would be quite complicated to work out how many tiles you could make like this. There are eight points around the edge of the square tile, two per edge, where four-coloured ropes enter and leave the tiles.

After a little examination, though, I realised the same asymmetric design is on all cards, and every card uses each colour once. This is a much simpler counting problem! There are four options for the colour of the first rope, then three for the second, two for the third, and the remaining colour goes to the fourth. There are $4!=4 \times 3 \times 2 \times 1 = 24$ possible tiles. The game comes with 25 tiles so you can make a square. Since we have 24 different patterns and 25 tiles, it follows that there must be more than one tile for at least one of the patterns (a concept called the pigeonhole principle).

In fact, all of the 24 different patterns are included and exactly one is duplicated; the duplicate tiles are these:

Rubik tangle tiles

Rubik explains that they made four variants of the Tangle puzzle. Each had the same basic 24 tiles with a different one duplicated. As an added bonus, if you combine all four sets, you can find a solution for them all together which fills a $10 \times 10$ square. Also, he says with the basic set you can find one solution to cover the surface of a $2 \times 2 \times 2$ cube so that there are four endless loops in the four colours. There are games with tiles that are harder to count. My next charity shop find is Squominos, a tie-in game for the 2005 Charlie and the Chocolate Factory film. Apart from three Wonka wild cards, each tile features four Oompa-Loompas in different colours and the game sees players placing tiles so that adjacent Oompa-Loompas match in colour:

Wonka Tiles

Wonka Wild card

Despite the colour choice similarity, these tiles are different from those in Rubik’s Tangle in two important ways: the design is symmetrical, and each colour may be used multiple times on a tile.

First let’s deal with the fact we can repeat colours. We now have many more than $4!$ ways to colour a tile. We can choose from four colours for the first Oompa-Loompa, then we have a choice of four for the second Oompa-Loompa too, and four colours for the third and fourth also. There are a total of $4^4=256$ colourings.

The symmetric design introduces a wrinkle at this point. One of our 256 options is when we choose yellow for the first colour, and blue for the other three. Another is when we choose yellow for the second colour, and blue for the other three. And there are two more selections with one yellow and three blue Oompa-Loompas. Using a simplified tile design with each Oompa-Loompa represented by a quadrant of the square, these four tiles look like this:

The thing is, if you hold a physical tile and turn it 90°, you aren’t suddenly holding a different tile. We have counted this design four times when in fact it only represents one distinct tile.

Since there are four tiles that are all the same (the original and one for each of three rotations), we might simply divide $256/4 = 64$ to correct for this duplication. We now have reasonable upper and lower bounds, but we do not have the answer. This is because not all tiles were counted four times in our 256. For example, one of the 256 is the selection where we choose blue for the first Oompa-Loompa, and blue for the others. This is only counted once among our 256:

 

 

Meanwhile, the tile where blue is chosen for the first and third and yellow for the second and fourth is duplicated only once in our count, when yellow is chosen for the first and third and blue for the second and fourth:

What we want to do is divide our count by four only for those tiles where there are more than one in the count that aren’t in fact distinct tiles. One way to do this is to divide 256 by four and then add back in the tiles we have accidentally removed from the count. Another way is to first increase 256 to account for the tiles that weren’t counted four times, then when we divide by four we will obtain the correct number of distinct tiles.

We can do this by considering when applying a symmetry to a tile leaves it looking identical. If this happens, we have a tile that hasn’t been counted four times, so we add one to our total before we divide. There is a clever way to do this using permutations. We can label the tile and consider permutations of the labels:

A permutation is a function which rearranges (or relabels) a set of objects. For example, a rotation of 90° clockwise ($\rho$) changes the tile above to this:

 

 

 

Here the region labelled 1 has been moved by the rotation to where we previously had 2, meanwhile 2 has moved to 3, 3 to 4, and 4 to 1. We can write a permutation as a product of disjoint cycles. In general, $(\dots xy \dots)$ means $x$ shifts to $y$ and $(x \dots y)$ means $y$ shifts to $x$. Our 90° rotation, therefore, is a permutation $(1234)$.

We will use permutations to count the cycles of quadrant labels that must be coloured the same for a tile to be unaffected by this permutation.

The permutation $(1234)$ is a cycle of length 4 because the four elements shift between themselves and if we do it four times we get back to where we started. We’ll label a cycle of length $i$ with $x_i$, so this is an $x_4$ cycle. Let’s collect the information we know about $\rho$:

We can do the same for a double rotation ($\rho^2$). This time, 1 has changed to 3 and 3 has changed to 1, a cycle of length 2. Meanwhile, 2 has become 4, and 4 has become 2, another $x_2$:

A triple rotation ($\rho^3$) is similar to a single rotation, just in the other direction:

The other symmetry we should consider might not seem like it’s worth considering at all: doing nothing. Or, equivalently, rotating four quarter turns. Either way, every element stays where it started. This is the identity ($e$) and is four one-cycles:

Summing our cycle representations, we get $x_1^4 + x_2^2 + 2x_4$. This expression represents the colourings that are unchanged by each symmetry. We can use this to obtain a big number, which if we divide by the number of symmetries will give us the distinct number of tiles. This is called the cycle index and is written

\[ P(x_1,x_2,x_3,x_4) = \frac{1}{4} \left( x_1^4 + x_2^2 + 2x_4 \right)\text{.} \]

Each cycle represents a set of quadrants that must be coloured the same if the tile is to be unchanged by this symmetry. Therefore we can colour each cycle four ways, and the total number of ways to colour the tiles is

\[P(4,4,4,4) = \frac{1}{4} \left( 4^4 + 4^2 + 2 \times 4 \right) = 70\text{.} \]

In this function, each colouring of our tile is included once for each symmetry that leaves it unaffected. Our all-blue tile is included by $e$ and by $\rho$, $\rho^2$, and $\rho^3$, ensuring it is overcounted sufficiently before we divide by four. Our blue, yellow, blue, yellow tile is included once by $e$ and once by $\rho^2$, as is its partner the yellow, blue, yellow, blue tile. Meanwhile, each of the four with one yellow and three blue quadrants is counted by $e$ and not by the other symmetries. In each case, we make sure we are getting exactly four of each distinct tile before dividing by four to get the true number of different tiles.

So, are there 70 tiles are in the Squominos box? Ah, no, there are 55.

What has happened? To find out, really we need a list of the 70 colourings to compare with the 55 tiles.

Actually, I’ve undersold our function $P(x_1,x_2,x_3,x_4)$. It doesn’t only count the number of tiles, it can also tell us how those tiles are coloured.

We can count things by expanding algebraic expressions. For example, if I toss a coin it might land heads ($H$) or tails ($T$). If I represent these choices with an expression$H+T$, I can find the possible outcomes from $n$ coin tosses by expanding $(H+T)^n$. For example, the outcomes from tossing three coins are given by

\[ (H+T)^3 = H^3 + 3H^2T + 3HT^2 + T^3 \text{.}\]

The $H^2$ and $H^3$ represent throwing double and triple heads, respectively. Terms with a coefficient other than one are telling us there are multiple ways to arrange those outcomes, for example $3H^2T$ tells us there are three ways to arrange two heads and one tail: $HHT$, $HTH$, and $THH$.

Here, we can colour a cycle of length $i$, $x_i$, with either $i$ red Oompa-Loompas, or $i$ green Oompa-Loompas, or $i$ blue or $i$ yellow. This means the options for each $x_i$ can be expressed as $r^i+g^i+b^i+y^i$.

We can therefore find all the different colourings using

Each term here represents a way to colour the tiles. Those with coefficients other than one reveal that there are multiple ways to colour tiles with that selection of colours. For example, the coefficient $2$ in the term $2b^2g^2$ tells us there are two fundamentally different ways to colour with two blue and two green Oompa-Loompas. All others are rotations of these:

So what is in the box and why are we missing 15 tiles? Examining the tiles I noticed a couple of omissions. First, consider tiles with two quadrants of one colour and the other two colours different, like $3gb^2y$ which can be coloured three ways:

Only the first two of these are in the box, the third is absent. There are 12 such terms in our expansion, so that accounts for 12 of the missing tiles.

In addition, there are 6 fundamentally different ways to colour the tiles using each colour once ($6bgry$), and only the first three of these are in the box:

At first I noticed that the missing $gb^2y$ is a reflection of one of those included. We didn’t include reflections in our calculations because the tiles are opaque—if you flip a tile over, you are not looking at a reflection of the Oompa-Loompas but the back of the tile. But in situations where the tiles are transparent, you could do the same analysis taking account of the four reflections as well as the rotations. If you do this, you will get this alternative cycle index,

\[ P_r(x_1,x_2,x_3,x_4) = \frac{1}{8} \left( x_1^4 + 3x_2^2 + 2x_4 + 2x_1^2x_2 \right)\text{,} \]

and it happens that $P_r(4,4,4,4) = 55$.

So did the folks behind Squominos do the maths taking account of reflections? I think a couple of bits of evidence point against this.

First, while the missing tiles in the terms like $3gb^2y$ are all mirrors of a tile that is included, we can’t say the same for the three from $6bgry$—two of the three in the box are reflections of each other.

Another strike against clever maths counting is that there is only one tile like $g^2ry$, and one like $bg^2r$ appears twice in the set:

There may be deep gameplay reasons why the manufacturers chose a particular selection of 54 tiles from the 70 possible tiles and then duplicated one. It’s also possible the process of designing the tiles was more heuristic.

One puzzle to leave you to ponder arises from three-colouring our tiles with $P(3,3,3,3)=24$ tiles. You can make yourself a set of these tiles by counting each colouring of $x_i$ using $g^i+b^i+y^i$ and expanding
$P(g+b+y,g^2+b^2+y^2,g^3+b^3+y^3,g^4+b^4+y^4)$. These are a generalisation of dominoes called the MacMahon squares.

Martin Gardner describes what he calls a “first rate puzzle” with the MacMahon squares: fit together all 24 squares in a four-by-six rectangle meeting two conditions: each pair of touching edges must be the same colour, and the outer border of the rectangle must be all one colour. He claimed there was only one solution when he first published the puzzle in his long-running Mathematical Games column in \textit{Scientific American} in March 1961, and later said this “proved to be the greatest understatement ever made in the column”.

Because of the missing tiles, I can’t solve this puzzle using my Squominos tiles, but why not try to make yourself a set of MacMahon squares? So you can check your answer, I’ve printed a set below. But don’t get any ideas about cutting up your copy of Chalkdust—the editors might ban me from ever writing again.

Peter is a reader in the mathematics group at Sheffield Hallam University, where among other things he teaches a module on game theory and recreational mathematics. His research investigates teaching and learning of mathematics at university level. He blogs at the Aperiodical.

More from Chalkdust