![]() ![]() The Java solution can be found in the java folder. The initial state of the problem is passed as input to the bread first search algorithm (class BreadthFirstSearch) that returns the solution to the problem. ![]() cross a two missionaries from left to right) that can be applied to a particular state and returns the valid successor states. The generateSuccessors method checks the actions (e.g. The problem was solved using three different languages: Java, Python and Prolog: JavaĪ State class saves the current state of the problem, that is, how many missionaries and cannibals are in each side of the river and where is the boat (left or right). Your goal in this game is to find out the answer of the. ![]() And, in some variations, one of the cannibals has only one arm and cannot row. The chieftain of the tribe requires the missionaries to solve an ancient riddle or they will be cooked. The boat cannot cross the river by itself with no people on board. If the missionaries on either side of the river, or in the boat, are outnumbered at any time by cannibals, dire consequences which may be guessed at will result. In this problem, three missionaries and three cannibals must cross a river using a boat which can carry at most two people, under the constraint that, for both banks, if there are missionaries present on the bank, they cannot be outnumbered by cannibals (if they were, the cannibals would eat the missionaries). Both missionaries and cannibals must cross the river safely. Solutions for the Missionaries and Cannibals Problem.
0 Comments
Leave a Reply. |