# # This is a Python program to find all solutions to the Missionary-Cannibal # Problem using a blind depth-first search with a stack keeping track of # the path from the root to the current state. # # There are 3 missionaries and 3 cannibals and a boat that holds 2 people. # Each state is of the form(nmiss, ncann, bside). # nmiss is the number of missionaries on the left side of the river. # ncann is the number of cannibals on the left side of the river. # bside is the side of the river that the boat is on: 'L' or 'R' # class State: "Missionary-Cannibal-Boat State" # # Finish state definition here. # def __init__(self, nmiss=0, ncann=0, bside=' '): #WRITE SOME CODE HERE # # The describe method returns a string form of a State: e.g. (0, 0, L) or (3, 1, R) # def describe(self): #WRITE SOME CODE HERE # # The goal method returns True if the state is the goal state (0,0,'R') # def goal(self): #WRITE SOME CODE HERE # # The illegal method returns True if a state is illegal, meaning there are # more cannibals than missionairies on either side of the rivers. # def illegal(self): #WRITE SOME CODE HERE