Problem 42619. Flip the right coin to survive!

Write a function to solve the problem mentioned below. The chessboard 8x8 matrix will be filled with coins randomly and given to you. Also the index key chosen by the warden will be given. All you need to find is the flipping index. (In testing boards 1 refers to heads whereas 0's are tails)

Standard setup: A prison warden is bored, so gives two prisoners the chance to escape, but only if they can solve a puzzle. They have 30 minutes to discuss a solution, but thereafter they will be placed in solitary confinement.

The problem: One prisoner is going to be put in front of a chessboard, with a coins on each square (such that there are 64 coins). The coins will be tossed and placed randomly, such that heads or tails can be showing on any given square. The warden is then going to point to a single coin and state 'This is the magic key'. The prisoner can then flip one, and only one, coin (doesn't have to be the one the warden pointed at). The first prisoner will be escorted away, and the second prisoner brought to the chessboard. The second prisoner must then point to a single square, and state 'This is the magic key'. The prisoner has only one chance - if correct, they go free. Can the prisoners find a strategy to guess the magic key correctly? If so how?

Solution Stats

33.33% Correct | 66.67% Incorrect
Last Solution submitted on Jun 06, 2022

Problem Comments

Solution Comments

Show comments

Problem Recent Solvers4

Suggested Problems

More from this Author6

Problem Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!