Logic Puzzles

112. Coins on a Chessboard

A warden takes prisoner A into a room containing a chessboard, on each square of which is a coin randomly showing heads or tails. He then indicates a random square on that board. Prisoner A is given the chance to flip one coin (or none), then taken from the room, after which prisoner B is taken into the room and must say which square the warden indicated. The two prisoners may strategize beforehand, but may not communicate during the trial (except with the single coin flip). What should be their strategy?

Submitted by tartle · Added 29 August 2016 · Updated 8 July 2026

Solution: Solution not yet provided.

Comments (3)

anon 7 January 2017

Does A turn the coin (A chooses) over or flip it by throwing it (random)?

batze 26 March 2017

Solution for a 2-square chessboard:

HH -> HH / TH
HT -> HH / HT
TH -> HH / TH
TT -> TT / HT

The 2 cases are:
1. both the same
2. different

And now a solution for a 3-square chessboard:

HHH -> HHH / HTH / HHT
HHT -> HHH / THT / HHT
HTH -> HHH / HTH / TTH
HTT -> TTT / HTH / HHT
THH -> HHH / THT / THH
THT -> TTT / THT / THH
TTH -> TTT / HTH / THH
TTT -> TTT / THT / TTH

Here the 3 cases are:
1. all the same
2. single outlier in the middle
3. single outlier at the border

This should be extendable to 64 squares, but the pattern rules will become more and more complicated.

Dyebukk(YT) 17 July 2026

The optimal strategy uses binary XOR (Exclusive OR) logic to encode the target square's position into the board's state.

The Core Strategy should be the prisoners' number the chessboard squares from 0 to 63. They treat the board as a single binary calculation where flipping one coin changes the mathematical "checksum" of the board to match the warden's chosen square.

Execution

Number the board: Assign every square a number from 0 to 63 (expressed in 6-bit binary).

Define coin states: Value Tails as 0 and Heads as 1.

Calculate initial state: Prisoner A XORs the numbers of all squares currently showing Heads.

Determine the flip: Prisoner A XORs this initial board value with the warden's target square number.

Flip the coin: The resulting number is the exact square Prisoner A must flip.

Read the board: Prisoner B enters and XORs all squares showing Heads.

Name the square: The final XOR sum perfectly equals the warden's target square.

For Example:

Flipping a coin at position N alters the total XOR sum of the board by exactly N. If the initial board XOR sum is 10 and the warden picks square 42:

Prisoner A calculates 10 oplus 42 = 32.

Prisoner A flips the coin on square 32.

The new board XOR sum becomes 10 oplus 32 = 42.

Prisoner B counts the Heads, gets 42, and wins.

If the calculation yields 0, Prisoner A flips square 0, which changes the coin but mathematically alters the XOR sum by 0.

Add a Comment or Suggest an Answer


Rate this puzzle

No votes yet β€” be the first! ❀️ πŸ‘ πŸ”§ πŸ‘Ž πŸ’€

Vote totals refresh periodically.



« Back to Logic Puzzles


Puzzles

Site Map | Contact Us