The Magic Trick
- 36 square forest tiles with a different colour on back and front – green for trees and brown for grass
- a smaller, thin shiny tile representing a treasure – it should not be visible when covered by a forest tile
- Arrange the tiles in a 5x5 square This can be done together with the audience, the more random the better.
- Let the magician have a short look at the board There is no actual memorizing involved but it helps to support the trick.
- Let the magician turn around and add tiles to make it a 6x6 square. This is where the trick happens: start adding tiles to each row and choose the colour such there is both an even number of green and brown tiles. Then add a tile to each column such that there is both an even number of green and brown tiles.
- Offer a member of the audience to bury the treasure in the forest by putting it on a tile and flipping them over together.
- Ask the magician to turn around and find the treasure.
The Trick & Background
We set up the board such that each row contains an even number of green and brown tiles. When a single tile is flipped over the particular row and column of this tile now have an odd number of green tiles. The magician only needs to look for this column and row and will find the treasure at their intersection.
In the context of computer science we can think of each tile as a bit: bits are the smallest amount of information and correspond to a yes/no decision. We usually write 0 and 1 for a bit and represent larger pieces of information as a series of bits. Each tile of the game represents a bit of information; instead of numbers we use the colours green and brown.
The actual magical trick comes from a technique called error correction. If we have to send data over an unreliable connection it is possible that a bit is transferred erroneously – it flips from zero to one or vice versa. The same happens when we bury the treasure. The additional tiles we have added allow us pinpoint which bit flipped. In computer science, this additional information is called a parity bit.
This particular error correction scheme can always correct a single mistake. If two bits changed we can still detect that there is a mistake but we cannot find out where. In terms of the board game, it could happen that we flip the second tile in the same row as the first. Now the number of green tiles in that row is again even but we can still see two columns that have an odd number of green tiles. The situation when a third error is introduced. But when four errors happen on tiles that are arranged in a rectangle, the all counts add up to even numbers again.
Computer Scientific Lessons
- Introduction of information theoretic notions: bits, transmissions, transmission errors and error correcting codes
- Development of a simple algorithm (pick the row with parity error, pick the column with parity error, find the treasure at the interesection)
- Opportunity to talk about barcodes / QR-codes, TCP error correction, etc.
- Marie Duflot-Kremer explains the magical trick (in French with English subtitles)
- The magical trick at CS Unplugged
This game description is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.