The Missionaries and Cannibals Puzzle

In this puzzle, there are $ m$ missionaries and $ c$ cannibals on the one bank of a river, together with a boat that can carry $ p$ passengers. Initially, $ m\leq c$. The object is to reach a state in which all missionaries and cannibals are on the West bank of the river. The difficulty is that if the missionaries ever outnumber the cannibals on either side of the river, that group of missionaries eats their unfortunate cannibal associates1. To successfully solve the puzzle, no cannibals may be devoured.

A MOVE consists of selecting a group of one or more passengers to load in the boat, rowing the boat across the river, and unloading the boat on the other side. Note that the boat cannot cross the river with no passengers and the boat cannot carry more passengers than its capacity. The river is full of hungry piranha and anybody attempting to swim will be devoured. The boat MUST be fully unloaded on the far side of the river, at which point the assessment of conversions is performed.

For the purposes of output, a MOVE is represented by:

MOVE $ i$: FERRY $ m_c$ Cannibals and $ m_m$ Missionaries FROM $ s_i$ TO $ s_f$

where $ m_c$ and $ m_m$ denote the number of cannibals and missionaries relocated during this move, respectively, and $ s_i$ and $ s_f$ denote the initial and final sides of the river. $ s_i$ and $ s_f\in{\mathrm{East},\mathrm{West}}$ and $ s_i\neq s_f$.

The output of a state is the same as the input format, specified by the rule MCSTATE in Section 3.2.

The null move (moving no people) is disallowed.

Terran Lane 2004-03-24