A river-crossing riddle that survived 1,200 years in a ninth-century puzzle book
You must ferry a wolf, a goat and a cabbage across the river. The boat holds you plus one. When you're away, the wolf eats the goat and the goat eats the cabbage. Can all three make it safely?
The crossing is solved not by the boat, but by the map of states.
Experiment
Hands-on experiment
This bank
Far bank
📖 Read more — why it exists · insights · common mistakes · formulasExpand ▾
Why
Why does this exist?
This puzzle appears in a ninth-century Latin problem collection, a book written to sharpen young minds. Twelve hundred years later it is still being solved in classrooms around the world.
It survived that long not because of its answer but because of its eye: the moment you express the problem as states — 'who is on which bank' — a bewildering puzzle becomes pathfinding on a map.
That eye is state-space search. How a navigator finds routes, how an AI makes plans, how a computer solves puzzles — the prototype of it all stands on this small riverbank.
Insight
Insights from the video
“Don't steer the boat — steer the state.”
The button you pressed said 'cross', but what actually changed was the state. Express a problem as states and the whole thing fits on one page. Ten dots are this entire puzzle.
“Every road passes through 'the goat comes back'.”
The state map has no shortcut. Whichever route you take, you pass the move that ferries the goat back. What looks like retreat is proven, by one picture, to be progress.
Misconception
Common misconceptions
Pushing everything forward as fast as possible is the quickest way.
The puzzle cannot be solved without a backward move. Unfold the state map and every route from start to goal passes through 'ferry the goat back'. The backward move isn't waste — it's the only road.
Every puzzle needs its own flash of insight.
Draw the states and the moves, and any puzzle yields to the same method: dots for possible states, lines for moves, then pathfinding. That is exactly how computers solve mazes, cubes, and navigation.
Formula
Writing it as math
Writing what you experienced at the riverbank in the language of math: express the problem as states, and the solution becomes a route between states.
🔬 Formula anatomy — matched with what you did in the game
+ =
State
One scene of the problem summarized as a bundle of information. No shapes, no colors — only who is where.
Counting states
Four characters, each on one of two banks: at most 16 arrangements. Remove the ones where someone gets eaten and only 10 safe states remain.
Solution = path
The answer to the puzzle is a route on the state map. 'Minimum 7 moves' means 'the shortest path has length 7'.
In Real Life
Where you meet it in real life
Navigation
Intersections are dots, roads are lines, and your navigator searches this state map for the shortest route — the same principle as the 7-move solution, over millions of dots.
Puzzles and games
A Rubik's cube has about 43 quintillion states, yet it's still a map of states. It's proven that every position solves within 20 moves.
AI planning
A robot vacuum's route, a game AI's lookahead, warehouse logistics — the backbone of what AI calls 'planning' is state-space search.
Machines designed as states
Elevators, washing-machine cycles and traffic lights are all machines designed from states and moves. Programmers call the blueprint a state machine.
Practice
Practice — conquer the types
✏️ 4 practice problems — solve to conquerTap to solve ▾
What is the minimum number of crossings needed to ferry all three across safely?
Why must the goat go first?
Four characters (farmer, wolf, goat, cabbage), each on one of two banks — how many arrangements at most?
What fact does the state map prove about 'ferrying the goat back'?
Watch
Related video
Connection
Concepts connect
Previous concept
The Bridges of Königsberg
Euler's eye turned a map into dots and lines — now turn states into dots and lines.
← The Bridges of Königsberg labLeads to next
Counting Cases
The grammar for counting states, like 2×2×2×2 — gauging a map's size before it explodes.
Go to the Counting Cases lab →Related
Labs worth exploring together
Related lab
Sets & Logic
'Who is on the left bank' is a set — the language states are written in.
Go to the Sets & Logic lab →Related lab
The Monty Hall Problem
Another intuition-defying problem where drawing the structure reveals the answer.
Go to the The Monty Hall Problem lab →