This lab will be spent working on and discussing possible solutions to the Missionaries and Cannibals problem. You will be working in groups of two, so pick a partner right away.
; build-list : natnum (natnum -> alpha) -> list-of-alpha ; (build-list n f) = (list (f 0) ... (f (sub1 n)))
MMMCCCb-- / \ / \ / \ v v MMMC--CCb MMCC--MCb / \ / \ / \ / \ / \ / \ v v v v MMMCCCb-- MMMCCb--C MMMCCCb--
There are two main ways of searching a set of states like this: depth-first and breadth-first. In depth-first search, we explore one move from the initial state, then one move from that, and so on until we get stuck. Then we back up and try another move and so on. Note that in depth-first search, we need some way to remember what states we have already visited, or else we may end up repeating states forever and never find a solution. In breadth-first search, we try all possible moves from the initial state, then all moves from them, and so on. With breadth-first search, we are certain to find a solution, if one exists, even without remembering the previously visited states. By the way, in the case of the Missionaries and Cannibals, there exits a solution in eleven moves, and this is the shortest that is possible.