# The coolest checkerboard magic trick. Version 2

Version 1: The coolest checkerboard magic trick

You and your friend are imprisoned. Your jailer offers a challenge. If you complete the challenge you are both free to go. The rules are

The jailer will take you into a private cell. In the cell will be a triangular chessboard and a jar containing 100 coins.

The jailer will take the coins, one-by-one, and place a coin on each triangle on the board. He will place the coins randomly on the board. Some coins will be heads, and some tails (or maybe they will be all heads, or all tails; you have no idea. It's all at the jailers whim. He may elect to look and choose to make a pattern himself, he may toss them placing them the way they land, he might look at them as he places them, he might not …). If you attempt to interfere with the placing of the coins, it is instant death for you. If you attempt to coerce, suggest, or persuade the jailer in any way, instant death. All you can do it watch.

Once all the coins have been laid out, the jailer will point to one of the triangles on the board and say: “This one!” He is indicating the magic triangle. This triangle is the key to your freedom.

The jailer will then allow you to turn over one coin on the board. Just one. A single coin, but it can be any coin, you have full choice. If the coin you select is a head, it will flip to a tail. If it is a tail it will flip to a head. This is the only change you are allowed to make to the jailers initial layout. You will then be lead out of the room. If you attempt to leave other messages behind, or clues for your friend … yes, you guessed it, instant death!

The jailer will then bring your friend into the room. Your friend will look at the board (no touching allowed), then examine the board of coins and decide which location he thinks is the magic triangle. He gets one chance only (no feedback). Based on the configuration of the coins he will point to one triangle and say: “This one!” If he guesses correctly, you are both pardoned, and instantly set free. If he guesses incorrectly, you are both executed.

The jailer explains all these rules, to both you and your friend, beforehand and then gives you time to confer with each other to devise a strategy for which coin to flip.

What strategy would you use to escape?

• ... do you mean 'magic triangle' and 'triangles' instead of 'magic square' and 'squares'? – boboquack Aug 8 '17 at 7:33
• there are 100 triangles, I believe it will be only possible if there would be 64 triangles. so it is impossible to communicate in this condition. – Oray Aug 8 '17 at 7:38

I don't think it's possible to escape 100% of the time. The best strategy (I think) is this:

Tell your friend to pick the head that is highest up (closest to the peak of the pyramid) and most to the left (These directions can be chosen arbitrarily). If there are no heads, tell him to pick the bottom right triangle.

When you are in the room:

1. If the magic triangle is a tail and there are no heads 'before' it (to the left or above), flip it. 2. If it is already a head, and there are no other heads 'before' it (above or to the left), flip a coin 'after' it (to the right or below). If this is the bottom right coin and there are no coins after it, flip the only head. Your friend will know what to do. 3. If it is already a head, and there is only one other head that is 'before' it (to the left or above), flip that to a tail.

This strategy will double your chances of surviving from 1/100 (if you play randomly) to about 1/50, I think.

To try to prove this, let's rearange the coins in a line, in order to make it easier to think about them. The order is the same as if you would read a book: the top coin is first, then the the next line, starting from leftmost coin. Let us number the coins from 1 to 100.

• If the first triangle is magic, you win no matter what, because of the strategy (you may check). Probability of this happening: 1/100
• If any other triangle is magic, you win only if:
• The magic triangle is a head and there are no more than 1 heads preceding it. Probability of this happening: (1/2) * ((1/2)^(n-1) + (1/2)^(n-1)*(n-1)), where n is the coin number
• The magic triangle is a tail and there are no heads preceding it. P = (1/2)*(1/2)^(n-1)

So the probability that you survive is:

(Which is twice as big as the probability you survive from a random guess.)

• Welcome to Puzzling! Why don't you take the tour? – boboquack Sep 11 '17 at 3:13

I wasn't going to put this in because it is obvious and I'm sure there are better answers, but the two answers so far give such a woeful chance of success that I thought I would provide my own.

Assumption: there is a known "top" to the board. You and your friend automatically can tell where the top of the board is based on cues in the room. Where the door is for example. If this is not possible (i.e. the board is randomly rotated before your friend enters) then we need a different strategy.

# You

Once the board is laid out and the jailer indicates the magic triangle, mentally flip this coin in your head; for all the calculations below, you will pretend that the coin on the magic triangle actually has the opposite value.

Now, take the first 64 squares starting at the top of the board working top to bottom, left to right. Map these to an 8x8 checker board. If the magic triangle is not in this set, start at bottom of the board instead taking the last 64 triangles.

Now solve the problem based on this well received answer. Basically compute the parity of all sections of the board and find the one square which when flipped makes all the parities 0. Call this square the target square. Since we are pretending that the magic square is flipped, we know that if the target square and the magic square are flipped, all the groupings will have a 0 parity. So by flipping the target square but not the magic square, your friend can compute the same parity and deduce which square when flipped will get back to 0 parity for all groups; this will be the magic square.

Back to the task at hand, you can now easily identify which triangle was mapped to the target square and this is the coin that you will flip.

Your friend comes into the room and sees the board. He now has to make a choice; either take the first 64 triangles and map them to an 8x8 checker board, or take the last 64 triangles. If he guesses the same set that you chose, then he will create the same 8x8 checker board that you did. He will then compute the parity of all the groupings and identify the square that will make all the groups have 0 parity. Once mapped back to to the triangular board, he will make his selection.

# Survival Chance

Since an 8x8 checker board can guarantee 100% survival, we know that if your friend picks correctly, you will survive. If he doesn't, you will die. Your friend has a 50% chance of picking correctly, so you have a 50% chance of survival.

# Rotated Board

One of the assumptions was you and your friend know the top of the board. If the board is randomly rotated, then you can achieve 33% by picking the first 64 squares using one of the 3 vertices as the top. If your friend picks the same vertex, you will survive. Otherwise, death.

Thus, your survival chance is 33%.

# Conclusion

I didn't originally post this as an answer because I assumed a guaranteed method of survival was available. Judging by the responses so far, this is a better answer, but still far from perfect. For example, since there are 100 triangles, 64 is more than half. Can we use this in some way? What if the magic square is valid for both orientations? Is there some way we can use this information?

I haven't attempted to look into these questions yet but may do so later.

Okay, I've thought about it and I believe that

It is not possible.
Consider a graph with $2^{100}$ nodes (these are the possible states of the board). Draw an edge between two nodes if it possible to get from one to the other by flipping a coin (This is a 100-cube, in a way). Now, we want to colour the vertices of this graph in 100 colours such that, given any node, there exists an adjacent node of each colour (that's pretty much the question, where each colour is a square). I'll expand on this in the note below. So for any colour $i$, there exist $2^{100}$ ordered (node, node) pairs where the first node has colour $i$. But, there exists a colour such that there are strictly less than $2^{100}/100$ nodes of that colour (since 100 is not a factor of $2^{100}$. Therefore there are strictly less than $2^{100}/100*100=2^{100}$ (node, node) ordered pairs where the first node has that colour, a contradiction.]

Note: Okay, re-reading what I wrote, it makes practically no sense at all. I'll see if I can fix it

Basically a node is coloured colour $i$ if, when your friend sees the board at that node, then they choose the $i$th square on the board. This should clarify things up a bit. And, with Jan Ivan's comment, instead of needing at least one of each colour in just the adjacent nodes, it needs of of each colour in either the adjacent nodes or itself. This seems more possible, but even if I come up with a situation which works, I wouldn't be able to translate that into an easily memorisable plan for you and your friend...

• I think you don't have to flip a coin if you are already in that state = 100 colors, but 101 possible moves? – Jan Ivan Aug 8 '17 at 10:43
• I interpreted it as you had to flip a coin, especially based on stuff like this but now that you've pointed it out, that seems more reasonable. – Wen1now Aug 8 '17 at 10:47