![]() There's no way to get a similar arrangement for anything greater than three, because you can't send enough missionaries at once to balance out the rest of the cannibals. The part of the solution where this applies looks something like this: ( M-1 C-1 3, because the solution for M = 3 already depends on the fact that you can have only cannibals on one side and they won't be able to do anything to the missionaries no matter how many there are on one side. Bring 1 missionary and 1 cannibal over again.Bring 1 missionary and 1 cannibal over.Find a way to get everyone to the other side, without ever leaving a group of missionaries in one place outnumbered by the cannibals in that place. The problem starts out in the state M C M C.įor the case of M being more than C, here's an algorithm to transfer 1 missionary and 1 cannibal at a time: The missionaries and cannibals problem is usually stated as follows: Three missionaries and three cannibals are on one side of a river, along with a boat that can hold one or two people. Let's define a b * c d to represent the state of the river at any given time: a missionaries and b cannibals on the left, c missionaries and d cannibals on the right, and * being if the boat is on the right.
0 Comments
Leave a Reply. |