Quant Memo
Core

The Chessboard Coin-Flip Prisoner Puzzle

A prisoner must guess a number hidden by an accomplice using only a single flip of one coin on a 64-square chessboard — an exact application of parity encoding, where the accomplice's flip choice is the message.

Prerequisites: Encoding Information With Parity in Hat Puzzles

A jailer places a coin heads-up or tails-up on each of the 64 squares of a chessboard, in a pattern of the jailer's choosing. The jailer then secretly picks one square and tells only the accomplice which one. The accomplice's job: flip the coin on exactly one square of their choosing (any square, not necessarily the secret one), and then leave. The prisoner enters, sees the entire board, and must name the secret square — with only the sight of the board, and knowing the accomplice flipped exactly one coin somewhere, to go on. No other communication is allowed. How can the accomplice guarantee the prisoner always identifies the correct square?

The core idea: 64 squares need exactly 6 bits, and one flip is exactly one bit

There are 64 possible secret squares, and 64=2664 = 2^6, so identifying one out of 64 needs exactly 6 bits of information. The accomplice can only perform one action — flipping one coin — which sounds like nowhere near enough. But a coin flip isn't "one unit of information" in a vacuum; it's a change to a specific bit of a pre-agreed 6-bit encoding scheme, chosen by the accomplice to correct whichever one of the six parity bits is currently wrong for the target square. One flip, aimed precisely, is exactly enough to fix exactly one bit of a 6-bit mismatch.

Working the scheme

Agree in advance: label the 64 squares 00 through 6363 in binary, using 6 bits. Partition the squares into six overlapping groups, G1G_1 through G6G_6, where GiG_i is the set of all squares whose binary label has a 1 in bit position ii (this is the same style of grouping used in the poisoned-wine binary-encoding puzzle). For any current arrangement of heads/tails on the board, define pip_i as the parity (even = 0, odd = 1) of the number of heads-up coins in group GiG_i. Read (p1,,p6)(p_1, \dots, p_6) as a 6-bit number — call it the board's current "checksum."

If the checksum already equals the secret square's label, the accomplice flips any coin outside all the groups whose bit differs... but actually the accomplice's job is simpler: compare the current checksum to the target label bit by bit. They differ in exactly one bit position, or in several — but flipping a single coin in a well-chosen square changes the parity of every group that square belongs to simultaneously. Since each square's own binary label tells you exactly which groups it's a member of, the accomplice computes the bitwise difference between the current checksum and the target label (an XOR of the two 6-bit numbers), treats that difference itself as a square's binary address, and flips the coin on that square. Flipping it toggles the parity of precisely the groups corresponding to the 1-bits of the difference — which, by construction, changes the checksum from its old value to exactly the target value, since XOR-ing a number with the difference between two values recovers the other value.

The prisoner, on entering, recomputes the six group parities from the visible board, reads them off as a 6-bit number, and that number is exactly the secret square's label.

current checksum XOR target label = the square to flip checksum now: 010110 target label: 011001 flip square: 001111 flipping that one square toggles exactly the bits that differ
The accomplice flips the single coin whose binary address equals the XOR of the current checksum and the target square, which toggles exactly the parity groups needed to shift the checksum to the target.

One flip can carry six bits of directed information because the accomplice isn't sending a single yes/no signal — they're correcting a pre-agreed 6-dimensional parity checksum by exactly the right amount, using the algebraic fact that XOR-ing a value with a difference recovers the target.

What this means in practice

This puzzle is a compact, hands-on demonstration of how error-correcting codes and single-bit-flip syndromes work — the same XOR-of-parity-groups trick underlies real checksum and parity-based data-integrity schemes used to detect and even correct single-bit corruption in transmitted data. For an interview, it also tests whether a candidate can generalize the parity-encoding idea from earlier hat and coin puzzles to a genuinely different setup (an action rather than a passive observation carrying the signal), which is the deeper transferable skill.

The trap is assuming a single coin flip can only communicate one bit, since a coin only has two states. What actually carries the information is which square is flipped, not the resulting face value — the choice of square among 64 options is itself a 6-bit message, precisely because the accomplice can select any square to flip.

Related concepts

Practice in interviews

Further reading

  • Peter Winkler, Mathematical Puzzles: A Connoisseur's Collection, ch. 2
ShareTwitterLinkedIn