The river crossing problem is a logic puzzle where a group must cross a river under specific constraints, often involving limited boat capacity or incompatible pairings. These puzzles require sequential planning to avoid violating rules, such as leaving certain individuals unattended. Solutions depend on the exact roles and restrictions defined in each version.
How the Classic River Crossing Problem Works
In the most common version, a farmer must transport a wolf, a goat, and a cabbage across a river using a small boat that can carry only the farmer and one item at a time. The constraints are that the wolf cannot be left alone with the goat, and the goat cannot be left alone with the cabbage. If the farmer leaves the wolf and goat unattended on one side, the wolf will eat the goat. If the goat and cabbage are left alone, the goat will eat the cabbage. The solution requires four round trips with precise sequencing.
The first move must be taking the goat across, leaving the wolf and cabbage together, which is safe. The farmer returns alone, then takes either the wolf or the cabbage across. Suppose the farmer takes the wolf across. Now the goat is alone on the far side, so the farmer must bring the goat back. Then the farmer leaves the goat and takes the cabbage across. Finally, the farmer returns alone and takes the goat across. This completes the puzzle in seven individual crossings (four trips across, three returns).
Common Variants and Their Rules
Different river crossing problems change the characters and constraints but follow the same logic structure. For example, in the “jealous husbands” version, three married couples must cross a river in a boat that holds two people. No woman can be in the presence of another man unless her husband is also present. This requires careful sequencing to avoid invalid states.
Another variant involves missionaries and cannibals: three missionaries and three cannibals must cross a river using a boat that holds two people. At no point can the cannibals outnumber the missionaries on either bank, or the missionaries will be eaten. The minimum number of crossings to solve this is 11.
Each variant defines specific incompatibilities and boat capacity. The solution always requires identifying safe intermediate states and reversing steps when necessary to transport items or people back.
Step-by-Step Solution for Wolf, Goat, and Cabbage
1. Farmer takes goat to the far side. (Left: wolf, cabbage; Right: goat; Boat: farmer returns alone)
2. Farmer returns alone to the near side.
3. Farmer takes wolf to the far side. (Left: cabbage; Right: goat, wolf; Boat: farmer takes goat back)
4. Farmer brings goat back to the near side.
5. Farmer takes cabbage to the far side. (Left: goat; Right: wolf, cabbage; Boat: farmer returns alone)
6. Farmer returns alone to the near side.
7. Farmer takes goat to the far side. (Left: empty; Right: wolf, goat, cabbage)
No rule is violated at any step. The goat is never left with the cabbage without the farmer, nor with the wolf. The cabbage and wolf can be left together safely.
Step-by-Step Solution for Three Missionaries and Three Cannibals
This puzzle requires that missionaries are never outnumbered by cannibals on either bank. The boat holds two people. The solution takes 11 crossings.
1. Two cannibals cross to the far side.
2. One cannibal returns.
3. Two cannibals cross again.
4. One cannibal returns. (Now three cannibals on near side, three missionaries on near side)
5. Two missionaries cross.
6. One missionary and one cannibal return.
7. Two missionaries cross again.
8. One cannibal returns.
9. Two cannibals cross.
10. One cannibal returns.
11. Two cannibals cross. All six are now on the far side with no violation.
At no point do cannibals outnumber missionaries on either bank. After step 6, one missionary and one cannibal are on the near side, and two missionaries are on the far side with one cannibal—safe because numbers are equal.
All river crossing puzzles can be solved by applying state-space search logic. Each side of the river has a state defined by who or what is present. A move changes the state. Invalid states violate the puzzle’s constraints. The goal is to reach the final state with all on the far side without passing through any invalid state.
The boat must always carry at least one person to move. In puzzles with intelligent agents (like humans or farmers), only they can operate the boat. Inanimate objects like cabbages cannot row.
Backtracking is often required. After transporting one item or person across, the solver may need to return with another to prevent a conflict. The key is to identify which entity must be moved back to maintain balance.
How to Identify Solvable River Crossing Problems
A river crossing puzzle is solvable only if the constraints allow a sequence of moves that avoids all forbidden configurations. If the boat is too small to allow necessary back-and-forth trips, or if the constraints are too strict, no solution exists.
For example, if the boat could only carry one passenger (farmer plus nothing else), the wolf-goat-cabbage puzzle would be unsolvable. The farmer could take the goat across, but then taking the wolf over would require leaving the goat alone with the cabbage on the return trip, which violates the rules.
In the missionaries and cannibals problem, a boat that holds only one person makes the puzzle unsolvable, as no two people can cross together, and cannibals would always outnumber missionaries during transfers.
When to Use Diagrams or Tables to Solve
Tracking each move with a table helps avoid errors. List the near side, far side, boat position, and move number. For the wolf-goat-cabbage puzzle:
| Move | Boat Action | Near Side | Far Side |
|---|---|---|---|
| 1 | Farmer + Goat → | Wolf, Cabbage | Goat |
| 2 | Farmer ← | Farmer, Wolf, Cabbage | Goat |
| 3 | Farmer + Wolf → | Cabbage | Goat, Farmer, Wolf |
| 4 | Farmer + Goat ← | Farmer, Goat, Cabbage | Wolf |
| 5 | Farmer + Cabbage → | Goat | Wolf, Farmer, Cabbage |
| 6 | Farmer ← | Farmer, Goat | Wolf, Cabbage |
| 7 | Farmer + Goat → | — | Wolf, Goat, Cabbage, Farmer |
Each row must satisfy the constraints. This method prevents oversight and makes it easier to spot where a mistake occurs. For more complex puzzles, such as those with four or more entities, a tree diagram showing possible moves can help identify dead ends and valid paths.