Here is a algorithms/riddle i just solved that was kind of fun. So heres the setup. You have a circular table that spins with four evenly spaces opaque boxes on it around the outside. In each box is a coin that is either heads or tails. You get a maximum of 5 rounds, between each round you are blindfolded and the table ia spun randomly. During each round you can pick a box to open, look, the pick a second box to open and look. You can then flip none, any, or all, of the coins with open boxes. Then the boxes are closed before the next round. If at any point all four coins are the same then you win the game.
You must come up with a strategy that **guarantees** in 5 rounds or less that all 4 coins will be the same.
Tommorow i will take a picture of the flow chart i came up with the answer. In the meantime please give hints, answer, or thoughts in the comments but be sure to CW them. I will reply tomorrow with a picture of the answer and CW that as well. Good luck!
PS for a slightly harder version all the same rules apply except you need to pick both boxes to open simultaneously rather than one after thr other. With this harder version it is still possible in 5 rounds or less.
#riddle #algorithm #computerscience #programming #algorithms #puzzle
@freemo I'm not really understanding this setup. So there's a round table, with 4 boxes on them in cardinal directions, let's say. Each box contains a coin.
5 times the table is spun randomly, you dunno since you're blindfolded. Then when a spin's done, you can open the box closest to you to check the status of the coin. You can decide to put it heads or tails.
So that's 5 times you can do this, no clue if it's the same coin or not since it was random without you being able to observe it.
Then you have to come up with a strategy that guarantees in 5 rounds or less that all 4 coins will be the same facing? Is that another 5 rounds, or is that this one 5 rounds?
@trinsec
Right it can be any 2 coins but you have no idea what coins were which in the roevious round since the table is spun