Culvert

Water runs through a network of pipes under a road, and your job is to block it by cutting them. Each cut costs whatever that pipe could carry, and you win by finding the cheapest set of cuts that stops the flow entirely.

How to play

The green end is the spring and the dark one is the sink, and a pipe's number is both what it carries and what it costs you to block.

  1. See where the water actually goes Blue pipes are running. Grey ones are already cut off from the spring, and blocking those is money wasted.
  2. Look for the narrow place Somewhere the network is thinner than everywhere else. That is where the cheap cut lives.
  3. Try a whole column, then improve it Blocking every pipe leaving one bank always works. It is rarely cheapest, but it tells you what to beat.
Full instructions

In depth

Finding the cheapest cut through a pipe network

How the pipe network is built, why blocking the biggest pipe is usually wrong, the theorem that tells you the exact price before you start, and a step-by-step method for finding the right set of pipes to block.

Screenshot: How to play Culvert
How to play Culvert as it appears when the page opens.

The setup: spring, pipes and sink

Water leaves a green spring on the left and flows through pipes toward a dark sink on the right. Every pipe has a number on it. That number means two things at once: how much water the pipe can carry, and how much it costs to block.

Your goal is to stop all water from reaching the sink. You do this by blocking pipes. But you have a budget, and every pipe you block costs its number. A pipe labelled five costs five to block. The puzzle is to find a set of blocked pipes that cuts the spring off from the sink completely, at or below the allowed cost.

Tap a pipe to block it. Tap it again to unblock it. Only the pipes blocked at the end count toward your cost. You can experiment as much as you like without penalty.

Blue pipes, grey pipes and what they tell you

The network uses colour to show you what is happening. Blue pipes are currently carrying water. They have a clear path back to the spring. Grey pipes are already cut off from the spring, either because you blocked something upstream or because the network's shape leaves them stranded.

Blocking a grey pipe wastes money. It is already doing nothing. Before you block a pipe, check its colour. If it is already grey, your budget is better spent elsewhere.

When you block a blue pipe, the network recalculates. Some pipes that were blue may turn grey because your block cut off their supply. Watch for that cascade. A single well-placed block can grey out several pipes at once.

Pipes that skip a column

The network has columns of junction points between the spring and the sink. Most pipes connect one column to the next. But one or two pipes jump straight past a column, linking a node on the left to a node two columns to the right.

These skip pipes are traps. If you block every pipe leaving one column but miss a skip pipe that goes around it, water still reaches the sink. Your cut is not actually a cut.

Before you call your answer final, check whether any skip pipes are still blue. They are easy to overlook because they cross the whole width of a column and sit behind the shorter pipes in the drawing. A quick visual scan from left to right catches them. If one is still blue, your cut is broken no matter how many other pipes you blocked.

Why big pipes are tempting but often wrong

A pipe labelled six looks important. It carries a lot of water and it must be stopped. But blocking it costs six, which might be half your budget on a small network. If two smaller pipes downstream carry the same water to the sink, blocking those two might cost less.

The cheapest cut is almost never the set of the largest pipes. It is the narrowest place in the whole network, and that place is often several small pipes spread across different paths.

Think of it this way: the water has to cross from left to right. Somewhere in the network there is a bottleneck where the total capacity is lower than everywhere else. That bottleneck is where the cheap cut lives, and the pipes there are usually the small ones.

The column method for finding a starting point

Here is a simple way to get a working cut. Pick a column of junction points. Block every pipe that leaves that column going right. That always works because no water can pass through without crossing at least one of those pipes.

Add up the cost. That number is an upper bound on the cheapest cut. It is rarely the answer, but it tells you what to beat. If blocking the second column costs twelve, you know the answer is twelve or less.

Now look for individual pipes in that set that you can unblock without letting water through. Sometimes a node on the right side of your column is already cut off by something else. The pipe leading to it is redundant, and unblocking it saves money.

The theorem behind the budget

The budget is always set to match the cheapest possible cut. That number comes from a theorem proved in nineteen fifty-six: the most water a network can deliver from spring to sink is always exactly equal to the cost of the cheapest set of pipes that stops all the water.

The game computes the maximum flow, and that figure becomes the par. Your budget is par plus a few extra to give you room to experiment. Any cut that costs par is perfect. Any cut that costs less than par does not exist.

This means you can check your own work. Count up the total capacity of every pipe leaving the spring. That is the most the spring could push out. Follow the water forward and find where the capacity shrinks. The total capacity at the narrowest crossing is the answer.

A worked example on a small network

The spring connects to two middle nodes through pipes of three and four. The first middle node connects to the sink through a pipe of two. The second middle node connects to the sink through a pipe of five. There is also a skip pipe from the spring to the sink with a capacity of one.

The spring can push out three plus four plus one equals eight. But the two middle paths can only deliver two plus five equals seven to the sink, plus the skip pipe's one. Total capacity is eight, but the actual flow is limited by the thinnest path.

Blocking the pipe of two, the pipe of five and the skip pipe costs two plus five plus one equals eight. That works but is expensive. Blocking the pipes of three and four from the spring cuts everything for seven. Cheaper, and still a full cut. Checking whether seven is the minimum takes trying a few more combinations.

Network sizes and how they change the puzzle

Small networks have two columns of middle nodes with two nodes each. The total number of pipes is low, and the cheapest cut usually involves three or four pipes. You can often spot the answer by eye.

Medium networks stretch to three columns of two or three nodes. More pipes means more paths for water to sneak through, and the skip pipes become more dangerous. You need to be systematic rather than intuitive.

Large networks go to three columns of three nodes with higher pipe capacities. The budget grows, the number of possible cuts explodes, and the difference between a good cut and the cheapest cut can be several points. Planning from the bottleneck inward becomes essential.

Mistakes that inflate the cost

  • Blocking grey pipes. They are already cut off and cost you money for nothing. Check the colour before you tap.
  • Missing a skip pipe. One overlooked pipe that jumps past your blocked column means water still flows and your cut is incomplete.
  • Blocking the biggest pipe first. It is natural but usually wrong. Small pipes at bottleneck crossings are cheaper targets.
  • Forgetting that unblocking is free. If you blocked something and changed your mind, tap it again. Only the final state counts.
  • Trying to slow the water instead of stopping it. The puzzle requires a complete cut. Even one surviving route means the spring still reaches the sink.

Thinking about it as a flow problem

If you enjoy this puzzle, the idea behind it shows up in many real problems. Scheduling tasks so that no resource is overloaded, matching workers to jobs so that nobody is idle, and segmenting an image into foreground and background all reduce to the same kind of network flow question.

The game gives you a hands-on feel for why the cheapest cut sits at the bottleneck. Once you have blocked a few networks by hand, the theorem stops being a fact you read and becomes something you have seen work a dozen times over.

Nothing leaves your device

The network is generated and checked entirely in your browser. No puzzle data is sent to a server, there is no account to create, and your best score is saved on this device only. After the page loads, the game keeps working with no connection at all.

Help

How to play Culvert

The green end is the spring and the dark one is the sink, and a pipe's number is both what it carries and what it costs you to block. Tapping a pipe blocks it and tapping again lets it go, so nothing is committed until the level is done. Leave no route at all between the two ends, for no more than the budget shown.

See where the water actually goes

Blue pipes are running. Grey ones are already cut off from the spring, and blocking those is money wasted.

Look for the narrow place

Somewhere the network is thinner than everywhere else. That is where the cheap cut lives.

Try a whole column, then improve it

Blocking every pipe leaving one bank always works. It is rarely cheapest, but it tells you what to beat.

Mind the pipes that skip a bank

One or two pipes jump straight past a bank. A cut that ignores them does not cut anything.

Max flow equals min cut

There are two obvious questions about a network like this. How much water can it deliver? And what is the cheapest way to stop it? They look like different questions, and one of them looks much harder than the other. In 1956 Lester Ford and Delbert Fulkerson proved they have the same answer, always. Any cut must be at least as big as the flow, since all the water crosses it — that part is easy. The surprise is that some cut is exactly as big as the flow, never larger. The theorem is now the backbone of scheduling, matching and image segmentation, and it is why this game can state par with confidence: it computes the maximum flow, reads the cut off the pipes the water has left slack, and the two numbers agree by theorem.

Good to know

Big pipes are often the wrong answer

A wide pipe is expensive to block. If something narrow downstream stops the same water, block that instead.

Every route must be broken

It is not enough to slow the water. One surviving route from spring to sink, however thin, means nothing is cut.

Unblocking is free

Only the pipes blocked at the end are counted, so experiment as much as you like.

Count what the network could deliver

Work out the most water that could ever reach the sink. That number is also the price of the cheapest cut.

Common questions

Does the water flow both ways?
No. Every pipe runs left to right, so the network can never loop back on itself.
Why did a pipe turn grey on its own?
Because nothing can reach it any more. It is already behind a block you made.
Can I win by blocking everything?
It would separate them, but the cost would be far over what you are allowed.
Is the cheapest cut unique?
Not always — a network can have several cuts at the same price. Any of them wins.
What is the number on each pipe?
Both what it carries and what it costs to block. That is the whole point of the puzzle.