Currently, I am modeling a problem that I am working on (in distributed systems) as a riddle and I'd like to know your opinions, suggestions and solutions. You can find it here on github.
Thirsty men problem:
On a hot day, a water outage occured 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 playing with 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.
Now the problem: The bottle (½ littre) 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 2 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
- The cups can be filled only if all of them are put .
- 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 cups positions (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.
- 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 with honesty 🐧
- A guest can drink only from his cup
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 avoiding a deadlock?
To make the situation more real let's assume that 2< N< 15.