Question 25
In front of Ali Baba's cave there is a device to open the door: it is a square-shaped carriage that has four closed chests located, one at each corner. In each chest there is a coin that can be heads or tails. The cave opens only if the four coins have the same position, all heads or all tails.
The genie controlling the entrance offers the visitor to choose two of the chests, open them, look at the two coins and leave them as they are or, if desired, turn over one of the coins or turn over the two coins in those chests. Next, if the cave does not open, the genie closes the two chests and quickly rotates the carousel so that it is impossible to know which chests have just been opened and closed. When the carousel stops, the genie offers the visitor a new opportunity, and so on. Determine a procedure for successive attempts that allows the visitor to ensure that the cave will open.
The genie controlling the entrance offers the visitor to choose two of the chests, open them, look at the two coins and leave them as they are or, if desired, turn over one of the coins or turn over the two coins in those chests. Next, if the cave does not open, the genie closes the two chests and quickly rotates the carousel so that it is impossible to know which chests have just been opened and closed. When the carousel stops, the genie offers the visitor a new opportunity, and so on. Determine a procedure for successive attempts that allows the visitor to ensure that the cave will open.