/MissionariesAndCannibals

It's a search algorithm application that previously made and has been modified by mine as the homework of Artificial Intelligence course.

Primary LanguageJava

MissionariesAndCannibals

The problem of missionaries and cannibals is resolved using the Java with breadth first search.

The main class is called the BreadthFirstSearch. A class named State has been used to control over coastal conditions.

The number of missionaries and monsters in the case class, the state of the boat on the left/right shore, and the state in which it is coming from are captured. In addition, the results obtained from each boat run are returned and the boolean method is used to ensure that errors do not occur in the variable values.

In the main class, operations are carried out in order to provide boat services until the right coast is completely empty. Information about the missionary, cannibalism and bot being left/right is kept in a queue. The shortest method to reach the initial state (3, 3, L) to (0, 0, R) is achieved through the while loop. Lastly, we are given information on how many boats have reached the final situation.

The link of non-modified application: http://cs.calstatela.edu/wiki/index.php/Courses/CS_460/Fall_2006/Shakil,_Farrukh/Missionaries_and_Cannibals_using_Search_Algos