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
Problem Comments
-
6 Comments
Hi Peng thanks for the descriptive comments you are right i have to change the question. Cheers
Hi Omer, any progress in modifying this interesting problem? Cheers.
Hi, Omer. This is a very interesting problem. Yet there are many possible correct strategies for the prisoners to follow and your testsuite only checks one particular strategy. Perhaps you could ask players to create a function that can be asked to act as the first prisoner or as the second prisoner and simply check that the second prisoner response correctly guesses the magic key?
Solution Comments
Show commentsProblem Recent Solvers4
Suggested Problems
-
Make the vector [1 2 3 4 5 6 7 8 9 10]
50219 Solvers
-
3891 Solvers
-
11754 Solvers
-
Back to basics 19 - character types
265 Solvers
-
47 Solvers
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!