Back to Exercises

Logic Puzzles

Classic River Crossing

Work through the famous farmer-fox-chicken-grain puzzle to build your constraint-satisfaction reasoning. You will learn to plan multiple steps ahead while keeping every constraint satisfied simultaneously — a skill that transfers directly to project management, scheduling, and strategic planning.

Beginner10 minLogic Puzzles

Context

Why this exercise

The farmer-fox-chicken-grain puzzle is older than most countries — versions appear in the 9th-century Alcuin manuscript 'Propositiones ad Acuendos Juvenes' (Problems to Sharpen the Young). It survives because it captures, in miniature, a problem you actually solve constantly: how to move forward through a sequence of states without ever leaving the system in an unacceptable configuration. Project schedules, deployment rollouts, surgical workflows, and even everyday errands are river-crossing problems in disguise. This exercise builds the underlying skill — planning multiple moves ahead while keeping every constraint satisfied simultaneously — through the classic puzzle and its variants.

Before you start

Formally, river-crossing puzzles belong to the family of constraint-satisfaction problems studied in artificial intelligence and operations research. Each puzzle defines a state space (all possible configurations of agents on each bank), a set of legal transitions (which moves the boat can make), and forbidden states (the configurations where an unacceptable interaction would occur). Solving the puzzle means finding a path through the state space from the initial state to the goal state that never passes through a forbidden state. The algorithmic technique that handles this in general is breadth-first or depth-first search, but humans typically solve small puzzles by combining forward planning with backward reasoning from the goal — looking ahead one or two moves while also checking whether a candidate state can plausibly lead to the destination.

The cognitive moves that matter most are state tracking and constraint enumeration. State tracking means keeping in mind not just what you just did but the full current configuration of the system: which agents are where, which constraints are about to become active, which moves are reversible if you take a wrong turn. Constraint enumeration means listing every prohibition explicitly before searching for a move, rather than relying on intuition. The single most common error in river-crossing puzzles is forgetting that the boat must return — a constraint that doubles the number of moves and changes the search structure entirely. The second most common error is local optimization: moving the most 'urgent' item next without checking whether the resulting state will let you complete the sequence at all.

These same moves transfer to real planning problems. A software deployment that involves database migrations, code changes, and feature flag toggles is a river-crossing puzzle: each transition can leave the system in a state where some users see new code reading old data or old code reading new schema, and the order of operations determines whether any forbidden intermediate state ever materializes. Surgical workflows, anesthesia protocols, and aviation checklists are river-crossing puzzles in which the constraints are safety-critical and the cost of a wrong sequence can be measured in lives. As you work through this exercise, practice writing down the state after each move and verifying it against the constraint list. For broader treatment of structured planning, see Problem Solving.

Question 1 of 520% Complete

A farmer needs to cross a river with a fox, a chicken, and a bag of grain. The boat only carries the farmer plus one item. Left alone together: the fox eats the chicken, and the chicken eats the grain. The farmer must get everything across safely. What is the critical first move?