# The tile-flipping game

The tile-flipping game uses 6 tiles that have a white side and a black side. It starts with the tiles arranged in a line with their white side facing up. $$\circ \circ \circ \circ \circ \circ$$ We then roll an ordinary 6-sided die 99 times. On each roll of the die, we flip over that number of tiles from left to right.

For example, if the first roll is 2, we will flip over the first two tiles: $$\underline{\bullet \bullet} \circ \circ \circ \circ$$ If the next roll is 4, we will flip over the first four tiles, which means the first two tiles are flipped back to white: $$\underline{\circ \circ \bullet \bullet} \circ \circ$$ After all the die rolls are done, the black player wins if there are more tiles black-side up than white-side up. If there are more tiles white-side up or it's equal, then the white player wins. (There are no draws.)

Which player has the advantage? What is their chance of winning?

• This feels like a pure maths question without a real puzzle to it. – No. 7892142 Jan 20 '15 at 9:27
• @No.7892142 If you try calculating the probabilities, you're going to be doing it for a long time. – theosza Jan 20 '15 at 9:46
• Huh. It's just adding up about 50 probabilities for each tile, isn't it? (Of course xnor's proof works well, but still - it's just maths in my eyes.) – No. 7892142 Jan 20 '15 at 9:47
• Five should be four in your explanation example 2. – Valentin Grégoire Jan 20 '15 at 10:36
• @ValentinGrégoire Thank you, fixed. – theosza Jan 20 '15 at 10:53

Each player has a 50% chance of winning.

First, note that the game is unchanged if we add seventh another tile that never flips and so always stays white, since white wins ties.

Now, we claim that if one player wins with rolls $r_1, \dots r_{99}$, then the other player wins with opposite rolls $7-r_1, \dots, 7-r_{99}$, which implies they have equal chances of winning.

Resolving a roll of $7-r$ is the same as resolving $r$ except flipping from the right, then flipping every tile. Since flips commute, the entire sequence $7-r_1, \dots, 7-r_{99}$ is equivalent to

1. resolving $r_1, \dots r_{99}$ except from the right, then
2. flipping every tile 99 times, which is equivalent to flipping them all once.

So, if $k$ tiles were white with the original rolls, then $k$ tiles are white after step 1 with the mirrored rolls, and $7-k$ are white after step 2, which means the opposite player has the majority and so is the winner.

There are three issues here:

• ties go to white
• there are an odd number of rolls
• the tiles all start white

At first glance it appears the first and last of these give an advantage to white.

Working backwards from the last tile, it will be black if an odd number of sixes are rolled, and white if an even number are rolled. On any two rolls there are 36 possible combinations. Of these, 1 is two sixes, 10 are a six and a not-six, and 25 are zero sixes. Even wins 26 to 10. There are an odd number of total rolls, and on that roll it's 5-1 there will be an even number (0) of sixes. So overwhelmingly (almost 3 to 1) the last tile will be white.

The second last tile will be black if the total number of 5s and 6s rolled is odd. 16 results involve only 1 through 4 so have zero 5s and 6s. 16 involve just 1 5 or 6. 4 involve both. So even wins here 20 to 16. Closer than the last digit, but still advantage white.

For the "4" tile, you need an odd number of 4/5/6 rolls in total. Still looking at two rolls at a time, of the 36 results 9 will involve zero 4/5/6. 9 will involve only 4/5/6 - an odd number. 9 will involve only 1 and 9 will involve 2. So here's it's 50-50 chance whether that tile ends up white or black.

I am skipping the "2" and "3" tiles for lack of time. My intuition is that they match 6 and 5 respectively, but with while and black switched. So overall the chances of "4" being white or black is 50-50, and whatever advantage white has on "6", black has on "2", and whatever advantage white has on "5", black has on "3". For those last 5 tiles, it's 50-50 who will have more of "their" colour.

Here's where I found myself surprised:

The 1 tile will flip every single time. Roll a 1 - you flip it. Roll a 2 - you flip it. Etc up to 6. It flips 99 times which is odd, therefore it will be black. The rules are therefore slightly less unfair than they first seemed. In reality you are dealing with 5 tiles (2 through 6.) If three or more are white, white wins. If three or more are black, black wins (because of the guaranteed black first tile.) Since the odds of each of those 5 tiles being white or black is 50-50, the game is (surprisingly) fair with each player having an equal chance to win.

If there were 98 or 100 rolls, this would not be the case.