본문으로 바로 이동 / Skip to content
Contents/Wolf, Goat and Cabbage

→ · Wolf, Goat and Cabbage

Wolf, Goat and Cabbage

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?

A river-crossing riddle that survived 1,200 years in a ninth-century puzzle book

Think about it first

Make a prediction first. Change one input at a time and compare what happens with what you expected.

Crossings: 0Tap one passenger to pick it (or none), then press cross.

This bank

🧑‍🌾
⛵≈

Far bank

Read the solution when you are ready

The crossing is solved not by the boat, but by the map of states.

Why does this question matter?

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.

Read the idea from another angle

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.

Now read the definitions with their conditions

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'.

Make one more distinction

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.

Where else can this idea help?

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.

Explain it in your own words

Check the idea with practice problems (4)

Questions completed 0 / 4

1. What is the minimum number of crossings needed to ferry all three across safely?

2. Why must the goat go first?

3. Four characters (farmer, wolf, goat, cabbage), each on one of two banks — how many arrangements at most?

4. What fact does the state map prove about 'ferrying the goat back'?

What question comes next?

Previous concept

deg

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 lab

Leads to next

nCr

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 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 →