![]() The first element represents the number of missionaries on the east bank the second represents the number of cannibals on the east bank the third represents the number of missionaries on the west bank the fourth represents the number of cannibals on the west bank the fifth represents the location of the boat, which can either be east or west. ![]() I've choosen to represent as state as a list containing five elements. How can all missionaries and cannibals get to the other side alive? The boat cannot cross the river by itself with no people on board. For both banks, if there are missionaries present on the bank, they cannot be outnumbered by cannibals, since the cannibals would eat the missionaries. They have a boat which is big enough to carry at most two people. Three missionaries and three cannibals are on the east side of a river. ![]() The well-known Missionaries and Cannibals problem is as follows:
0 Comments
Leave a Reply. |