On a hot day, a water outage occurred while you were feeling very thirsty. You went to the fridge to get some cold water. You were lucky enough and you found a single bottle of water left. While you were enjoying this finding and tossing your bottle in the air. Ding dong, somebody rang at the door.
You had got N unexpected guests, all of them staring at the bottle in your hand, and suddenly shouting all once "we are thirsty". You let them in, and you all gathered in the same room around a table and everybody asked you to drink.
The bottle can only fill 3 cups.
To overcome this problem you've ingeniously proposed a solution. You gave them each an empty cup and told them :
โLook guys I will drink a cup and give you the 2 remaining cups of water. But, I'll fill only the first and the last cups put on the table before me. The intermediaries cups will remain emptyโ
Besides your main rule, you agreed upon the following terms:
- It's only you who can pour water (You are the host)
- The cups can be filled only if all of them are put on the table.
- The cups should be put in a row (the first one is the head of the row and the last is the tail). We can assume that the pourer has marked the final spots (first place, second,.. last), so each cup should be placed in one of these positions.
- No timer will be used and the game doesn't have a timeout. However, if a timeout can help solve this problem you can set one (1 < x days).
- It's up to you to determine who is the first depositor/winner in case they race to put the first cup (in the first position).
- You will act honestly ๐ง , however the guests can behave honestly or dishonestly
- A guest can drink only from his cup, but he can give his cup to another player.
- The host is only responsible of pouring water. He is not to be involved in your solution. He ensures that the rules as executed as defined.
The question : In this context, how would your guests behave, if you know that they are smart and can cheat ๐ (but cannot kill each other ๐)? Would there be a good compromise (winning strategy) avoiding a deadlock?
To make the situation more real let's assume that 2<N<15
If you require additional information about the problem please open an issue in this repository. I'll provide the necessary clarifications
Please fork/clone the repository, write your solution in a .txt file under the /solutions folder and then propose a pull request. If the answer is correct the pull request will be accepted and you'll be added as contributor.