Card Flip Magic

This page recreates the Card Flip Magic "trick" from the CS Unplugged web-site without the need to find 36 double-sided cards.

Ask a student to arrange the "cards" in a 5 x 5 grid, in any pattern they choose. They can flip the cards by clicking/tapping.

To "make it more difficult", you add an extra row and column, ensuring that there's an even number of black cards (i.e. 1s) in each row and column. You can do this by pressing a key (other than F1) or by touching the screen with two fingers. These are effectively the parity bits that allow you to detect changes.

Look away and ask the student to flip a card. You can identify the card that was flipped because it's in the column and row with an odd number of black cards (or 1s). This is a demonstration of using even parity. Ask the students whether it would work if you turned over two cards.

Press F1 or tap with three fingers for Help