Cannibal Problem
Four programmers are trapped in the offices of a small software company. Their names and weights (in lbs) are as follows:
- Adam 200
- Benjamin 190
- Caleb 180
- Daniel 170
After a couple of weeks, they have consumed all of the food in the office, and are on the brink of starvation. Naturally, they turn to cannibalism. The bigger people argue that they should get more votes; after all, if it comes down to a melee, they will probably win. How long does each person survive, given the following rules?
- Each time they run out of food, the group will elect a person to kill and eat. Each person casts a number of votes equal to the number of pounds they weigh. As soon as a majority of the pounds voting agree on eating someone, the vote is closed and he is killed.
- After a person is killed, each of the remaining people will eat one pound of the deceased developer's flesh each day until the body is gone. Then they vote again, and so on.
- Each person is trying to maximize the number of days that he will live.
- Everyone is perfectly logical and feels no loyalty or anger.
- Everyone is good at math.
Extra fun for programmers:
Now, write a program to solve the general problem, and run it for this larger set of people:
- Adam 200
- Benjamin 190
- Caleb 180
- Daniel 170
- Ephraim 160
- Frank 150
- Gideon 140
- Hiram 130
- Ichabod 120
- Jacob 110
- Kenan 100
- Lehi 90
Extra extra fun for programmers:
Okay, now suppose that each cannibal consumes 1% of his body weight per day instead of one pound. Adapt your solution to this situation.